From d892c928ede0bb4e21b10c2bddf7c2c3504cfc76 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Wed, 4 Mar 2015 18:45:36 +0200 Subject: [PATCH 1/8] add 'nohup' to init.d script for Ubuntu --- etc/ubuntu/init.d/maxscale.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ubuntu/init.d/maxscale.in b/etc/ubuntu/init.d/maxscale.in index 269f88638..0ad5b53c4 100755 --- a/etc/ubuntu/init.d/maxscale.in +++ b/etc/ubuntu/init.d/maxscale.in @@ -58,7 +58,7 @@ RETVAL=0 start() { log_daemon_msg "Starting MaxScale" - start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null + nohup start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null & sleep 2 From 3dacb257c97aa03aca8afe74f771666cc2189da4 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Wed, 4 Mar 2015 21:38:52 +0200 Subject: [PATCH 2/8] Revert "add 'nohup' to init.d script for Ubuntu" This reverts commit d892c928ede0bb4e21b10c2bddf7c2c3504cfc76. --- etc/ubuntu/init.d/maxscale.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ubuntu/init.d/maxscale.in b/etc/ubuntu/init.d/maxscale.in index 0ad5b53c4..269f88638 100755 --- a/etc/ubuntu/init.d/maxscale.in +++ b/etc/ubuntu/init.d/maxscale.in @@ -58,7 +58,7 @@ RETVAL=0 start() { log_daemon_msg "Starting MaxScale" - nohup start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null & + start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null sleep 2 From 89ce2823e5019c62bbd9d177e08f588c9e54ddbe Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Wed, 4 Mar 2015 21:52:51 +0200 Subject: [PATCH 3/8] redirect all output from start_daemon to /dev/null --- etc/ubuntu/init.d/maxscale.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/ubuntu/init.d/maxscale.in b/etc/ubuntu/init.d/maxscale.in index 269f88638..21a4e425e 100755 --- a/etc/ubuntu/init.d/maxscale.in +++ b/etc/ubuntu/init.d/maxscale.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # maxscale: The MariaDB Corporation MaxScale database proxy # @@ -58,7 +58,7 @@ RETVAL=0 start() { log_daemon_msg "Starting MaxScale" - start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null + start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null > /dev/null sleep 2 From ecafc17c4a07c8b06bb9d40e0d5b76ec3ce86c93 Mon Sep 17 00:00:00 2001 From: Martin Brampton Date: Thu, 5 Mar 2015 05:44:45 +0000 Subject: [PATCH 4/8] Update bug database location; remove obsolete SETUP. --- README | 2 +- SETUP | 33 --------------------------------- 2 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 SETUP diff --git a/README b/README index d105075ae..8d3c08a13 100644 --- a/README +++ b/README @@ -29,7 +29,7 @@ issues and communicate with the MaxScale community. or use the [forum](http://groups.google.com/forum/#!forum/maxscale) interface Bugs can be reported in the MariaDB Corporation bugs database - [bug.mariadb.com](http://bugs.mariadb.com) + [https://mariadb.atlassian.net/secure/CreateIssue!default.jspa](https://mariadb.atlassian.net/secure/CreateIssue!default.jspa) under project MXS. \section Documentation diff --git a/SETUP b/SETUP deleted file mode 100644 index 4e51bef5d..000000000 --- a/SETUP +++ /dev/null @@ -1,33 +0,0 @@ -Installation and startup - -Untar the binary distribution in the desired location, -e.g. /usr/local/skysql - -Alternatively build from the source code using the instructions -in the README file and execute make install. - -Simply set the environment variable MAXSCALE_HOME to point to the -MaxScale directory, found inside the path into which the files have been copied, -e.g. MAXSCALE_HOME=/usr/local/skysql/maxscale - -Also you will need to optionaly set LD_LIBRARY_PATH to include the 'lib' folder, -found inside the path into which the files have been copied, -e.g. LD_LIBRARY_PATH=/usr/local/skysql/maxscale/lib - -To start MaxScale execute the command 'maxscale' from the bin folder, -e.g. /usr/local/skysql/maxscale/bin/maxscale or by using the -installed init.d script. - -Configuration - -You need to create and edit the file MaxScale.cnf in $MAXSCALE_HOME/etc. -You should define the set of server definitions you require, with the addresses -and ports of those servers. Also define the listening ports for your -various services. - -In order to view the internal activity of MaxScale you can telnet to -the port defined for the telnet listener. Initially you may login with -the user name of "admin" and the password "skysql". Once connected type -help for an overview of the commands and help for the more -detailed help on commands. Use the 'add user' command to add a new user -which will also remove the admin/skysql user. From b6e5c8a953e2115e2b7a7d66bf4631d17b310d54 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 5 Mar 2015 10:18:46 +0200 Subject: [PATCH 5/8] Removed SETUP from installation. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c8ade55f..8e31e8fb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,6 @@ install(FILES ${ERRMSG} DESTINATION mysql) install(FILES ${CMAKE_SOURCE_DIR}/COPYRIGHT DESTINATION .) install(FILES ${CMAKE_SOURCE_DIR}/README DESTINATION .) install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION .) -install(FILES ${CMAKE_SOURCE_DIR}/SETUP DESTINATION .) install(DIRECTORY DESTINATION log) # Install startup scripts and ldconfig files From d6da4c750105cffb206469dcb84264eb41e14c7e Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 5 Mar 2015 10:25:25 +0200 Subject: [PATCH 6/8] Added a note about tee filter currently not supporting multi-statements to the documentation. --- Documentation/filters/Tee-Filter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/filters/Tee-Filter.md b/Documentation/filters/Tee-Filter.md index be77e83b8..777b16fa9 100644 --- a/Documentation/filters/Tee-Filter.md +++ b/Documentation/filters/Tee-Filter.md @@ -6,7 +6,7 @@ The tee filter is a filter module for MaxScale is a "plumbing" fitting in the Ma # Configuration -The configuration block for the TEE filter requires the minimal filter parameters in it’s section within the MaxScale.cnf file, stored in $MAXSCALE_HOME/etc/MaxScale.cnf, that defines the filter to load and the service to send the duplicates to. +The configuration block for the TEE filter requires the minimal filter parameters in it’s section within the MaxScale.cnf file, stored in $MAXSCALE_HOME/etc/MaxScale.cnf, that defines the filter to load and the service to send the duplicates to. Currently the tee filter does not support multi-statements. [DataMartFilter] From 1ff0756044800716fa63f78b2d0670d340a73b15 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 5 Mar 2015 12:37:39 +0200 Subject: [PATCH 7/8] Added a command line option for syslog logging. --- log_manager/log_manager.cc | 28 +++++++++++++++++++++++++++- log_manager/log_manager.h | 1 + server/core/gateway.c | 20 ++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/log_manager/log_manager.cc b/log_manager/log_manager.cc index 4179f5c49..6713d41d7 100644 --- a/log_manager/log_manager.cc +++ b/log_manager/log_manager.cc @@ -52,6 +52,8 @@ static int prevval; static simple_mutex_t msg_mutex; #endif static int highprec = 0; +static int do_syslog = 1; + /** * Variable holding the enabled logfiles information. * Used from log users to check enabled logs prior calling @@ -392,7 +394,13 @@ static bool logmanager_init_nomutex( fw = &lm->lm_filewriter; fn->fn_state = UNINIT; fw->fwr_state = UNINIT; - + + if(!do_syslog) + { + free(syslog_id_str); + syslog_id_str = NULL; + } + /** Initialize configuration including log file naming info */ if (!fnames_conf_init(fn, argc, argv)) { @@ -1703,11 +1711,14 @@ static bool fnames_conf_init( case 'l': /** record list of log file ids for syslogged */ + if(do_syslog) + { if (syslog_id_str != NULL) { free (syslog_id_str); } syslog_id_str = optarg; + } break; case 'm': @@ -1720,6 +1731,7 @@ static bool fnames_conf_init( case 's': /** record list of log file ids for later use */ + if(do_syslog) shmem_id_str = optarg; break; case 'h': @@ -3083,7 +3095,21 @@ void skygw_log_sync_all(void) skygw_message_wait(lm->lm_clientmes); } +/** + * Toggle high precision logging + * @param val 0 for disabled, 1 for enabled + */ void skygw_set_highp(int val) { highprec = val; +} + + +/** + * Toggle syslog logging + * @param val 0 for disabled, 1 for enabled + */ +void logmanager_enable_syslog(int val) +{ + do_syslog = val; } \ No newline at end of file diff --git a/log_manager/log_manager.h b/log_manager/log_manager.h index 10ccdea1c..64462a25d 100644 --- a/log_manager/log_manager.h +++ b/log_manager/log_manager.h @@ -120,6 +120,7 @@ int skygw_log_enable(logfile_id_t id); int skygw_log_disable(logfile_id_t id); void skygw_log_sync_all(void); void skygw_set_highp(int); +void logmanager_enable_syslog(int); EXTERN_C_BLOCK_END const char* get_trace_prefix_default(void); diff --git a/server/core/gateway.c b/server/core/gateway.c index 0d1c9cbf5..c5507a4bb 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -150,6 +150,7 @@ static struct option long_options[] = { {"config", required_argument, 0, 'f'}, {"nodaemon", no_argument, 0, 'd'}, {"log", required_argument, 0, 'l'}, + {"syslog", required_argument, 0, 's'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, '?'}, {0, 0, 0, 0} @@ -995,6 +996,8 @@ static void usage(void) " (default: $MAXSCALE_HOME/etc/MaxScale.cnf)\n" " -l|--log=... log to file or shared memory\n" " -lfile or -lshm - defaults to shared memory\n" + " -s|--syslog= log messages to syslog" + " true or false - defaults to true" " -v|--version print version info and exit\n" " -?|--help show this help\n" , progname); @@ -1057,6 +1060,7 @@ int main(int argc, char **argv) void* log_flush_thr = NULL; int option_index; int logtofile = 0; /* Use shared memory or file */ + int syslog_enabled = 1; /** Log to syslog */ ssize_t log_flush_timeout_ms = 0; sigset_t sigset; sigset_t sigpipe_mask; @@ -1096,7 +1100,7 @@ int main(int argc, char **argv) goto return_main; } } - while ((opt = getopt_long(argc, argv, "dc:f:l:v?", + while ((opt = getopt_long(argc, argv, "dc:f:l:vs:?", long_options, &option_index)) != -1) { bool succp = true; @@ -1201,7 +1205,17 @@ int main(int argc, char **argv) succp = false; } break; - + case 's': + if(strstr(optarg,"=")) + { + strtok(optarg,"= "); + syslog_enabled = config_truth_value(strtok(NULL,"= ")); + } + else + { + syslog_enabled = config_truth_value(optarg); + } + break; case '?': usage(); rc = EXIT_SUCCESS; @@ -1563,6 +1577,8 @@ int main(int argc, char **argv) argv[0] = "MaxScale"; argv[1] = "-j"; argv[2] = buf; + + logmanager_enable_syslog(syslog_enabled); if (logtofile) { From 1299cf6ac96114443d33da502d15e33e4fd0e196 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 5 Mar 2015 12:41:09 +0200 Subject: [PATCH 8/8] Fixed hktask_add not comparing task names if there was only a single task. --- server/core/housekeeper.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/core/housekeeper.c b/server/core/housekeeper.c index 2225e628f..584910b6d 100644 --- a/server/core/housekeeper.c +++ b/server/core/housekeeper.c @@ -116,9 +116,20 @@ HKTASK *task, *ptr; ptr = ptr->next; } if (ptr) + { + if (strcmp(ptr->name, name) == 0) + { + spinlock_release(&tasklock); + free(task->name); + free(task); + return 0; + } ptr->next = task; + } else + { tasks = task; + } spinlock_release(&tasklock); return task->nextdue;