Merge branch 'develop' into MAX-348

This commit is contained in:
MassimilianoPinto 2015-03-05 12:59:44 +01:00
commit bb2609e161
9 changed files with 61 additions and 41 deletions

View File

@ -139,7 +139,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

View File

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

2
README
View File

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

33
SETUP
View File

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

View File

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

View File

@ -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;
}

View File

@ -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);

View File

@ -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)
{

View File

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