From 194ebcb05456a9e564de1ae834f6528db68ae44c Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Mon, 6 Oct 2014 15:13:18 +0300 Subject: [PATCH 1/9] Fix to bug 567(http://bugs.mariadb.com/show_bug.cgi?id=567) log_manager.cc: if the file exists, is a symbolic link and is not writable, the log manager does not fail but unlinks it and creates a new one. --- log_manager/log_manager.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/log_manager/log_manager.cc b/log_manager/log_manager.cc index f690661b6..24db3b8a5 100644 --- a/log_manager/log_manager.cc +++ b/log_manager/log_manager.cc @@ -2169,8 +2169,7 @@ static bool logfile_init( if (!writable || !file_is_symlink(logfile->lf_full_link_name)) { - nameconflicts = true; - goto file_create_fail; + unlink(logfile->lf_full_link_name); } } } From 81b09e7c4de0d8a0d6ec750494210fed467b1de0 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Wed, 8 Oct 2014 11:26:36 +0100 Subject: [PATCH 2/9] Additional tests for maxadmin and diagnostics within maxscale --- client/test/maxadmin_test.sh | 129 +++++++++++++++++++++++++++++++---- 1 file changed, 117 insertions(+), 12 deletions(-) diff --git a/client/test/maxadmin_test.sh b/client/test/maxadmin_test.sh index b04312da4..5540fc380 100644 --- a/client/test/maxadmin_test.sh +++ b/client/test/maxadmin_test.sh @@ -19,58 +19,58 @@ else fi maxadmin --password=skysql help >& /dev/null if [ $? -eq "1" ]; then - echo "Auth test (long option): Failed" + echo "Auth test (long option): Failed" failure=`expr $failure + 1` else passed=`expr $passed + 1` - echo "Auth test (long option): Passed" + echo "Auth test (long option): Passed" fi maxadmin -pskysql enable log debug >& /dev/null if [ $? -eq "1" ]; then - echo "Enable debug log: Failed" + echo "Enable debug log: Failed" failure=`expr $failure + 1` else passed=`expr $passed + 1` - echo "Enable debug log: Passed" + echo "Enable debug log: Passed" fi maxadmin -pskysql enable log trace >& /dev/null if [ $? -eq "1" ]; then - echo "Enable trace log: Failed" + echo "Enable trace log: Failed" failure=`expr $failure + 1` else passed=`expr $passed + 1` - echo "Enable trace log: Passed" + echo "Enable trace log: Passed" fi maxadmin -pskysql disable log debug >& /dev/null if [ $? -eq "1" ]; then - echo "Disable debug log: Failed" + echo "Disable debug log: Failed" failure=`expr $failure + 1` else passed=`expr $passed + 1` - echo "Disable debug log: Passed" + echo "Disable debug log: Passed" fi maxadmin -pskysql disable log trace >& /dev/null if [ $? -eq "1" ]; then - echo "Disable trace log: Failed" + echo "Disable trace log: Failed" failure=`expr $failure + 1` else passed=`expr $passed + 1` - echo "Disable trace log: Passed" + echo "Disable trace log: Passed" fi for cmd in clients dcbs filters listeners modules monitors services servers sessions threads do maxadmin -pskysql list $cmd | grep -s '-' >& /dev/null if [ $? -eq "1" ]; then - echo "list command ($cmd): Failed" + echo "list command ($cmd): Failed" failure=`expr $failure + 1` else passed=`expr $passed + 1` - echo "list command ($cmd): Passed" + echo "list command ($cmd): Passed" fi done @@ -206,5 +206,110 @@ do fi done +maxadmin -pskysql list services | \ + awk -F\| '{ if (NF > 1) { sub(/ +$/, "", $1); printf("show service \"%s\"\n", $1); } }' > script1.$$ +grep -cs "show service" script1.$$ >/dev/null +if [ $? -ne "0" ]; then + echo "list services: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "list services: Passed" +fi +maxadmin -pskysql script1.$$ | grep -cs 'Service' > /dev/null +if [ $? -ne "0" ]; then + echo "Show Service: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "Show Service: Passed" +fi +rm -f script1.$$ + + +maxadmin -pskysql list monitors | \ + awk -F\| '{ if (NF > 1) { sub(/ +$/, "", $1); printf("show monitor \"%s\"\n", $1); } }' > script1.$$ +grep -cs "show monitor" script1.$$ >/dev/null +if [ $? -ne "0" ]; then + echo "list monitors: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "list monitors: Passed" +fi +maxadmin -pskysql script1.$$ | grep -cs 'Monitor' > /dev/null +if [ $? -ne "0" ]; then + echo "Show Monitor: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "Show Monitor: Passed" +fi +rm -f script1.$$ + + +maxadmin -pskysql list sessions | \ + awk -F\| ' /^0x/ { if (NF > 1) { sub(/ +$/, "", $1); printf("show session \"%s\"\n", $1); } }' > script1.$$ +grep -cs "show session" script1.$$ >/dev/null +if [ $? -ne "0" ]; then + echo "list sessions: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "list sessions: Passed" +fi +maxadmin -pskysql script1.$$ | grep -cs 'Session' > /dev/null +if [ $? -ne "0" ]; then + echo "Show Session: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "Show Session: Passed" +fi +rm -f script1.$$ + + +maxadmin -pskysql list dcbs | \ + awk -F\| ' /^ 0x/ { if (NF > 1) { sub(/ +$/, "", $1); sub(/ 0x/, "0x", $1); printf("show dcb \"%s\"\n", $1); } }' > script1.$$ +grep -cs "show dcb" script1.$$ >/dev/null +if [ $? -ne "0" ]; then + echo "list dcbs: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "list dcbs: Passed" +fi +maxadmin -pskysql script1.$$ | grep -cs 'DCB' > /dev/null +if [ $? -ne "0" ]; then + echo "Show DCB: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "Show DCB: Passed" +fi +rm -f script1.$$ + + +maxadmin -pskysql list services | \ + awk -F\| '{ if (NF > 1) { sub(/ +$/, "", $1); printf("show dbusers \"%s\"\n", $1); } }' > script1.$$ +grep -cs "show dbusers" script1.$$ >/dev/null +if [ $? -ne "0" ]; then + echo "list services: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "list services: Passed" +fi +maxadmin -pskysql script1.$$ | grep -cs 'Users table data' > /dev/null +if [ $? -ne "0" ]; then + echo "Show dbusers: Failed" + failure=`expr $failure + 1` +else + passed=`expr $passed + 1` + echo "Show dbusers: Passed" +fi +rm -f script1.$$ + + echo "Test run complete. $passed passes, $failure failures" exit $failure From 9c49cd87b1a44e0bfcdc5cf9ec00f31ab7355ae5 Mon Sep 17 00:00:00 2001 From: VilhoRaatikka Date: Wed, 15 Oct 2014 11:25:17 +0300 Subject: [PATCH 3/9] Fix to #571, http://bugs.mariadb.com/show_bug.cgi?id=571 In rwsplit router, merge multiple (query) buffers to one if necessary. --- server/modules/routing/readwritesplit/readwritesplit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 505c7c5d1..07820b076 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -1708,6 +1708,12 @@ static int routeQuery( } goto retblock; } + /** If buffer is not contiguous, make it such */ + if (querybuf->next != NULL) + { + querybuf = gwbuf_make_contiguous(querybuf); + } + master_dcb = router_cli_ses->rses_master_ref->bref_dcb; CHK_DCB(master_dcb); From 87b14d973f479e2fc58f1ca064bcccec8422415a Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Wed, 15 Oct 2014 12:42:26 +0300 Subject: [PATCH 4/9] Running testall target with CMake doesn't overwrite the existing MaxScale.cnf anymore. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37cc1fc0f..0c133c311 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,7 +144,7 @@ add_custom_target(buildtests add_custom_target(testall COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR} COMMAND make install - COMMAND cp -v ${CMAKE_SOURCE_DIR}/server/test/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf + COMMAND cp -vn ${CMAKE_SOURCE_DIR}/server/test/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf COMMAND /bin/sh -c "${CMAKE_BINARY_DIR}/bin/maxscale -c ${CMAKE_BINARY_DIR} &>/dev/null" COMMAND /bin/sh -c "make test || echo \"Test results written to: ${CMAKE_BINARY_DIR}/Testing/Temporary/\"" COMMAND killall maxscale From 1a59e1b188df0a5eb85d6c32ad5d550bd75c9461 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Wed, 15 Oct 2014 12:39:34 +0100 Subject: [PATCH 5/9] Bug 559 - Remove password file before starting test_adminusers --- server/core/test/testadminusers.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/core/test/testadminusers.c b/server/core/test/testadminusers.c index 4a67b1f5b..eb2ee8e40 100644 --- a/server/core/test/testadminusers.c +++ b/server/core/test/testadminusers.c @@ -266,6 +266,14 @@ int main(int argc, char **argv) { int result = 0; +char *home, buf[1024]; + + /* Unlink any existing password file before running this test */ + if ((home = getenv("MAXSCALE_HOME")) == NULL) + home = "/usr/local/skysql"; + sprintf(buf, "%s/etc/passwd", home); + if (strcmp(buf, "/etc/passwd") != 0) + unlink(buf); result += test1(); result += test2(); From fa278a2167573d9e8eb6c6cd363a122ac8c51ed8 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Wed, 15 Oct 2014 12:48:07 +0100 Subject: [PATCH 6/9] Bug 570 - memory manageing in hint parameters --- server/core/hint.c | 4 ++-- server/core/test/testhint.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/core/hint.c b/server/core/hint.c index 052c02486..0564625a4 100644 --- a/server/core/hint.c +++ b/server/core/hint.c @@ -116,7 +116,7 @@ HINT *hint; return head; hint->next = head; hint->type = HINT_PARAMETER; - hint->data = pname; + hint->data = strdup(pname); hint->value = strdup(value); return hint; } @@ -151,4 +151,4 @@ bool hint_exists( p_hint = &(*p_hint)->next; } return succp; -} \ No newline at end of file +} diff --git a/server/core/test/testhint.c b/server/core/test/testhint.c index b615baced..3ec5d9953 100644 --- a/server/core/test/testhint.c +++ b/server/core/test/testhint.c @@ -49,7 +49,7 @@ HINT *hint; hint = hint_create_parameter(NULL, strdup("name"), "value"); ss_info_dassert(NULL != hint, "New hint list should not be null"); ss_info_dassert(0 == strcmp("value", hint->value), "Hint value should be correct"); - ss_info_dassert(0 != hint_exists(hint, HINT_PARAMETER), "Hint of parameter type should exist"); + ss_info_dassert(0 != hint_exists(&hint, HINT_PARAMETER), "Hint of parameter type should exist"); ss_dfprintf(stderr, "\t..done\nFree hints."); if (NULL != hint) hint_free(hint); ss_dfprintf(stderr, "\t..done\n"); From a63e251d09011de00cf9c4e2829032ead7eb7b24 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Wed, 15 Oct 2014 13:03:12 +0100 Subject: [PATCH 7/9] Bug 431 - replace == with = --- server/modules/routing/readwritesplit/test/rwsplit.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/readwritesplit/test/rwsplit.sh b/server/modules/routing/readwritesplit/test/rwsplit.sh index fcca4ac37..7c9ec5edb 100755 --- a/server/modules/routing/readwritesplit/test/rwsplit.sh +++ b/server/modules/routing/readwritesplit/test/rwsplit.sh @@ -18,7 +18,7 @@ echo "" exit 1 fi -if [ "$#" == "$NARGS" ] +if [ "$#" = "$NARGS" ] then echo "CTest mode" TDIR=$7 #this is only used by CMake @@ -267,7 +267,7 @@ do break fi done -if [[ "$err" == "" ]] +if [[ "$err" = "" ]] then echo "TEST PASSED" >> $TLOG else @@ -293,7 +293,7 @@ do break fi done -if [[ "$err" == "" ]] +if [[ "$err" = "" ]] then echo "TEST PASSED" >> $TLOG else From 4acd85cf825eb23f32876d709855cb2c0be77f11 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Wed, 15 Oct 2014 13:26:00 +0100 Subject: [PATCH 8/9] Add missing trim() call to the server list code for monitors --- server/core/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/core/config.c b/server/core/config.c index 61bc6157d..181b009fc 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -817,7 +817,7 @@ int error_count = 0; int found = 0; while (obj1) { - if (strcmp(s, obj1->object) == 0 && + if (strcmp(trim(s), obj1->object) == 0 && obj->element && obj1->element) { found = 1; @@ -1449,7 +1449,7 @@ SERVER *server; int found = 0; while (obj1) { - if (strcmp(s, obj1->object) == 0 && + if (strcmp(trim(s), obj1->object) == 0 && obj->element && obj1->element) { found = 1; From b35b269b37a20a0a15a8b9e87dd31a48c6a8782d Mon Sep 17 00:00:00 2001 From: counterpoint Date: Wed, 15 Oct 2014 14:45:10 +0100 Subject: [PATCH 9/9] Added support for git-doc --- support/changelog.md | 2 + support/faq.md | 2 + support/gitdoc.json | 5 +++ support/guide/overview.md | 2 + support/reference/layout.md | 14 +++++++ support/reference/premium.md | 27 ++++++++++++++ support/tutorial.md | 71 ++++++++++++++++++++++++++++++++++++ 7 files changed, 123 insertions(+) create mode 100644 support/changelog.md create mode 100644 support/faq.md create mode 100644 support/gitdoc.json create mode 100644 support/guide/overview.md create mode 100644 support/reference/layout.md create mode 100644 support/reference/premium.md create mode 100644 support/tutorial.md diff --git a/support/changelog.md b/support/changelog.md new file mode 100644 index 000000000..d9917d9b7 --- /dev/null +++ b/support/changelog.md @@ -0,0 +1,2 @@ +### 2013/06/15 ++ Some example changes diff --git a/support/faq.md b/support/faq.md new file mode 100644 index 000000000..dcb005de6 --- /dev/null +++ b/support/faq.md @@ -0,0 +1,2 @@ +### is this a question? +An answer diff --git a/support/gitdoc.json b/support/gitdoc.json new file mode 100644 index 000000000..d1d45cd9c --- /dev/null +++ b/support/gitdoc.json @@ -0,0 +1,5 @@ +{ + "googleGroup": "group_name", + "irc": {"server": "irc.freenode.net", "channel": "#a_channel"}, + "domain": "yoursite.com" +} diff --git a/support/guide/overview.md b/support/guide/overview.md new file mode 100644 index 000000000..2d943c295 --- /dev/null +++ b/support/guide/overview.md @@ -0,0 +1,2 @@ +This directory is useful for many things, like how to install your software, if it has a CLI you +can tell people how to use it, any many other uses. diff --git a/support/reference/layout.md b/support/reference/layout.md new file mode 100644 index 000000000..622a999bc --- /dev/null +++ b/support/reference/layout.md @@ -0,0 +1,14 @@ +### Navigation +On the documentation/guide/reference pages, the sections created in your reference and guide +directories will be listed on the right as the main navigation links, you can have subsections too. +Any h3(###) lines you include in your reference/guide files will be added to the subsections under +the main section link. They will be hidden until you hover over the main section link or have +clicked the section link. + +### Headers +You can use any size headers you want, but it is adivised to use h3(###) and smaller, anything +bigger than h3(e.g. h2) is usually too big for the default layout. + +### Scrolling +When you scroll down the page the navigation will follow you if the screen is big enough for the +navigation to fit on the right side, otherwise it sits at the top. diff --git a/support/reference/premium.md b/support/reference/premium.md new file mode 100644 index 000000000..25500d5a6 --- /dev/null +++ b/support/reference/premium.md @@ -0,0 +1,27 @@ +### Premium repositories +Once you get premium, the plan you selected delegates the number of premium repositories you're +allowed to have. Premium repositories have many features not available without a premium plan. + +### Personally hosted repositories +The premium repositories you select are allowed to be hosted on their own domains, you can choose +a domain in your `support/gitdoc.json` file. Just add a `domain` field with your domain, and +point your domain at our site, and it will automatically load your repo. + +### Private repositories +Private repositories cannot be viewed without being set as a premium repository. + +### Custom CSS +You're premium repos can have custom layouts through CSS. Once you add a premium repo, simply create +the file `support/styles.css` and refresh your repo, when the page refreshes you'll be able to +see the custom CSS in action. + +### Branches +On premium repositories, you can select the branch you want to pull updates from, this is useful +if you plan to display the documentation for a specific version of your software. + +### Standard Git repos +Standard Git repositories from non Github servers are supported after you have a premium plan. +To add a standard repo to your account, add support for the repository(You can get the setup +details from your profile page.), after that go to your profile page and at the bottom will be +a form where you can fill out the information to add your repository. After that it can be updated +just like any other repository. diff --git a/support/tutorial.md b/support/tutorial.md new file mode 100644 index 000000000..f27a6b372 --- /dev/null +++ b/support/tutorial.md @@ -0,0 +1,71 @@ +### Introduction +After you run the command on the profile page a basic setup is created for you, including this +tutorial and a few other files. These files include content describing some of the details on +how to format the content. + +### Adding support +If you used the script to generate the support files, you can skip this section. + +In your repository to add support you'll need the `support` directory, inside this directory +you will need to create a `gitdoc.json` file. This file contains details about the repository. +``` +$ mkdir support/ +$ touch support/gitdoc.json +``` +The other files in the `support` directory are optional, only `gitdoc.json` is required. + +The following sections describe the information needed in the files. + +### gitdoc.json +There are a few fields in this file that make it easy to give your viewers extra details about +the community, as well as the domain for premium repos. + +#### googleGroup +This is a field you can use to give your viewers a link to your google group. Just set the field +to the name of your google group, and we'll create the link. It isn't required though, you can +leave it out safely. + +#### irc +This is a field you can use to give your viewers the details to join your irc channel. To use it +set an `object` with two fields. One of the fields is `server`, this is the server address for the +irc network(e.g. `irc.freenode.net` for the freenode network). The next is the `channel` field, +this tells the viewers the specific channel for your community. The channel requires you to +include the prefix character though(e.g. #, &, +, !), since there are multiple. + +#### domain +This is a field you can use if your repository is premium. It tells us the name of the domain +for your repo, so we can get your repo if we detect a custom domain. You can ignore it, or just +set a placeholder if it's not premium yet. + +#### analytics +When you view the repo from a custom premium domain, if this field is given it'll include the +Google Analytics snippet to track page views. This value should be your GA web property ID. + +### changelog.md +This file is just a markdown file displaying the changelog for your repository. For details on +the markdown, view the default documentation created. This file can be safely ignored if you don't +want to include a changelog page. + +### faq.md +This file is just a markdown file displaying the frequently asked questions for your repository. +For details on the markdown, view the default documentation created. This file can be safely +ignored if you don't want to include a faq page. + +### tutorial.md +This file is just a markdown file displaying the tutorial for your repository. For details on the +markdown, view the default documentation created. This file can be safely ignored if you don't +want to include a tutorial page. + +### styles.css +This file is used when your repository is premium to display custom layouts for your viewers. It +can be safely ignored, or just as a place holder if the repo is not premium yet. + +### reference/ +This directory is used to hold the markdown files for the documentation/reference page. Every file +in this directory will be added as a section to the documentation with the section titled after +the file name, so make sure it's readable. + +### guide/ +This directory is used to hold the markdown files for the documentation/guide page. Every file in this +directory will be added as a section to the guide with the section titled after the file name, so +make sure it's readable.