Merge branch 'develop' into firewall

This commit is contained in:
Markus Makela 2014-10-16 14:13:19 +03:00
commit 3ae29eb363
16 changed files with 267 additions and 25 deletions

View File

@ -144,7 +144,7 @@ add_custom_target(buildtests
add_custom_target(testall 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 ${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 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 "${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 /bin/sh -c "make test || echo \"Test results written to: ${CMAKE_BINARY_DIR}/Testing/Temporary/\""
COMMAND killall maxscale COMMAND killall maxscale

View File

@ -19,58 +19,58 @@ else
fi fi
maxadmin --password=skysql help >& /dev/null maxadmin --password=skysql help >& /dev/null
if [ $? -eq "1" ]; then if [ $? -eq "1" ]; then
echo "Auth test (long option): Failed" echo "Auth test (long option): Failed"
failure=`expr $failure + 1` failure=`expr $failure + 1`
else else
passed=`expr $passed + 1` passed=`expr $passed + 1`
echo "Auth test (long option): Passed" echo "Auth test (long option): Passed"
fi fi
maxadmin -pskysql enable log debug >& /dev/null maxadmin -pskysql enable log debug >& /dev/null
if [ $? -eq "1" ]; then if [ $? -eq "1" ]; then
echo "Enable debug log: Failed" echo "Enable debug log: Failed"
failure=`expr $failure + 1` failure=`expr $failure + 1`
else else
passed=`expr $passed + 1` passed=`expr $passed + 1`
echo "Enable debug log: Passed" echo "Enable debug log: Passed"
fi fi
maxadmin -pskysql enable log trace >& /dev/null maxadmin -pskysql enable log trace >& /dev/null
if [ $? -eq "1" ]; then if [ $? -eq "1" ]; then
echo "Enable trace log: Failed" echo "Enable trace log: Failed"
failure=`expr $failure + 1` failure=`expr $failure + 1`
else else
passed=`expr $passed + 1` passed=`expr $passed + 1`
echo "Enable trace log: Passed" echo "Enable trace log: Passed"
fi fi
maxadmin -pskysql disable log debug >& /dev/null maxadmin -pskysql disable log debug >& /dev/null
if [ $? -eq "1" ]; then if [ $? -eq "1" ]; then
echo "Disable debug log: Failed" echo "Disable debug log: Failed"
failure=`expr $failure + 1` failure=`expr $failure + 1`
else else
passed=`expr $passed + 1` passed=`expr $passed + 1`
echo "Disable debug log: Passed" echo "Disable debug log: Passed"
fi fi
maxadmin -pskysql disable log trace >& /dev/null maxadmin -pskysql disable log trace >& /dev/null
if [ $? -eq "1" ]; then if [ $? -eq "1" ]; then
echo "Disable trace log: Failed" echo "Disable trace log: Failed"
failure=`expr $failure + 1` failure=`expr $failure + 1`
else else
passed=`expr $passed + 1` passed=`expr $passed + 1`
echo "Disable trace log: Passed" echo "Disable trace log: Passed"
fi fi
for cmd in clients dcbs filters listeners modules monitors services servers sessions threads for cmd in clients dcbs filters listeners modules monitors services servers sessions threads
do do
maxadmin -pskysql list $cmd | grep -s '-' >& /dev/null maxadmin -pskysql list $cmd | grep -s '-' >& /dev/null
if [ $? -eq "1" ]; then if [ $? -eq "1" ]; then
echo "list command ($cmd): Failed" echo "list command ($cmd): Failed"
failure=`expr $failure + 1` failure=`expr $failure + 1`
else else
passed=`expr $passed + 1` passed=`expr $passed + 1`
echo "list command ($cmd): Passed" echo "list command ($cmd): Passed"
fi fi
done done
@ -206,5 +206,110 @@ do
fi fi
done 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" echo "Test run complete. $passed passes, $failure failures"
exit $failure exit $failure

View File

@ -2217,10 +2217,10 @@ static bool logfile_init(
/** Found similarly named file which isn't writable */ /** Found similarly named file which isn't writable */
if (!writable || if (!writable ||
file_is_symlink(logfile->lf_full_file_name)) file_is_symlink(logfile->lf_full_file_name))
{ {
nameconflicts = true; unlink(logfile->lf_full_file_name);
goto file_create_fail; nameconflicts = true;
} }
} }
else else
{ {

View File

@ -817,7 +817,7 @@ int error_count = 0;
int found = 0; int found = 0;
while (obj1) while (obj1)
{ {
if (strcmp(s, obj1->object) == 0 && if (strcmp(trim(s), obj1->object) == 0 &&
obj->element && obj1->element) obj->element && obj1->element)
{ {
found = 1; found = 1;
@ -1449,7 +1449,7 @@ SERVER *server;
int found = 0; int found = 0;
while (obj1) while (obj1)
{ {
if (strcmp(s, obj1->object) == 0 && if (strcmp(trim(s), obj1->object) == 0 &&
obj->element && obj1->element) obj->element && obj1->element)
{ {
found = 1; found = 1;

View File

@ -116,7 +116,7 @@ HINT *hint;
return head; return head;
hint->next = head; hint->next = head;
hint->type = HINT_PARAMETER; hint->type = HINT_PARAMETER;
hint->data = pname; hint->data = strdup(pname);
hint->value = strdup(value); hint->value = strdup(value);
return hint; return hint;
} }
@ -151,4 +151,4 @@ bool hint_exists(
p_hint = &(*p_hint)->next; p_hint = &(*p_hint)->next;
} }
return succp; return succp;
} }

View File

@ -266,6 +266,14 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int result = 0; 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 += test1();
result += test2(); result += test2();

View File

@ -49,7 +49,7 @@ HINT *hint;
hint = hint_create_parameter(NULL, strdup("name"), "value"); hint = hint_create_parameter(NULL, strdup("name"), "value");
ss_info_dassert(NULL != hint, "New hint list should not be null"); 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 == 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."); ss_dfprintf(stderr, "\t..done\nFree hints.");
if (NULL != hint) hint_free(hint); if (NULL != hint) hint_free(hint);
ss_dfprintf(stderr, "\t..done\n"); ss_dfprintf(stderr, "\t..done\n");

View File

@ -1708,6 +1708,12 @@ static int routeQuery(
} }
goto retblock; 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; master_dcb = router_cli_ses->rses_master_ref->bref_dcb;
CHK_DCB(master_dcb); CHK_DCB(master_dcb);

View File

@ -18,7 +18,7 @@ echo ""
exit 1 exit 1
fi fi
if [ "$#" == "$NARGS" ] if [ "$#" = "$NARGS" ]
then then
echo "CTest mode" echo "CTest mode"
TDIR=$7 #this is only used by CMake TDIR=$7 #this is only used by CMake
@ -267,7 +267,7 @@ do
break break
fi fi
done done
if [[ "$err" == "" ]] if [[ "$err" = "" ]]
then then
echo "TEST PASSED" >> $TLOG echo "TEST PASSED" >> $TLOG
else else
@ -293,7 +293,7 @@ do
break break
fi fi
done done
if [[ "$err" == "" ]] if [[ "$err" = "" ]]
then then
echo "TEST PASSED" >> $TLOG echo "TEST PASSED" >> $TLOG
else else

2
support/changelog.md Normal file
View File

@ -0,0 +1,2 @@
### 2013/06/15
+ Some example changes

2
support/faq.md Normal file
View File

@ -0,0 +1,2 @@
### is this a question?
An answer

5
support/gitdoc.json Normal file
View File

@ -0,0 +1,5 @@
{
"googleGroup": "group_name",
"irc": {"server": "irc.freenode.net", "channel": "#a_channel"},
"domain": "yoursite.com"
}

View File

@ -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.

View File

@ -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.

View File

@ -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.

71
support/tutorial.md Normal file
View File

@ -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.