Merge branch 'develop' into schemarouter_refresh
This commit is contained in:
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
|
|
||||||
# Create directories
|
# Create directories
|
||||||
mkdir -p @MAXSCALE_LIBDIR@
|
mkdir -p @CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@
|
||||||
mkdir -p @MAXSCALE_BINDIR@
|
mkdir -p @CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@
|
||||||
mkdir -p @MAXSCALE_SHAREDIR@
|
mkdir -p @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@
|
||||||
mkdir -p @MAXSCALE_DOCDIR@
|
mkdir -p @CMAKE_INSTALL_PREFIX@/@MAXSCALE_DOCDIR@
|
||||||
mkdir -p @MAXSCALE_CONFDIR@
|
|
||||||
|
# MAXSCALE_VARDIR is an absolute path to /var by default
|
||||||
mkdir -p @MAXSCALE_VARDIR@/log/maxscale
|
mkdir -p @MAXSCALE_VARDIR@/log/maxscale
|
||||||
mkdir -p @MAXSCALE_VARDIR@/lib/maxscale
|
mkdir -p @MAXSCALE_VARDIR@/lib/maxscale
|
||||||
mkdir -p @MAXSCALE_VARDIR@/cache/maxscale
|
mkdir -p @MAXSCALE_VARDIR@/cache/maxscale
|
||||||
|
|||||||
@ -24,11 +24,11 @@
|
|||||||
/** Default file locations, configured by CMake */
|
/** Default file locations, configured by CMake */
|
||||||
static const char* default_cnf_fname = "maxscale.cnf";
|
static const char* default_cnf_fname = "maxscale.cnf";
|
||||||
static const char* default_configdir = "/etc/";
|
static const char* default_configdir = "/etc/";
|
||||||
static const char* default_piddir = "/var/run/maxscale/";
|
static const char* default_piddir = "@MAXSCALE_VARDIR@/run/maxscale/";
|
||||||
static const char* default_logdir = "/var/log/maxscale/";
|
static const char* default_logdir = "@MAXSCALE_VARDIR@/log/maxscale/";
|
||||||
static const char* default_datadir = "/var/lib/maxscale/";
|
static const char* default_datadir = "@MAXSCALE_VARDIR@/lib/maxscale/";
|
||||||
static const char* default_libdir = "@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@";
|
static const char* default_libdir = "@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@";
|
||||||
static const char* default_cachedir = "/var/cache/maxscale/";
|
static const char* default_cachedir = "@MAXSCALE_VARDIR@/cache/maxscale/";
|
||||||
static const char* default_langdir = "@MAXSCALE_VARDIR@/lib/maxscale/";
|
static const char* default_langdir = "@MAXSCALE_VARDIR@/lib/maxscale/";
|
||||||
|
|
||||||
static char* configdir = NULL;
|
static char* configdir = NULL;
|
||||||
|
|||||||
@ -123,7 +123,7 @@ startMonitor(void *arg,void* opt)
|
|||||||
MONITOR* mon = arg;
|
MONITOR* mon = arg;
|
||||||
GALERA_MONITOR *handle = mon->handle;
|
GALERA_MONITOR *handle = mon->handle;
|
||||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||||
bool have_events = false;
|
bool have_events = false,script_error = false;
|
||||||
if (handle != NULL)
|
if (handle != NULL)
|
||||||
{
|
{
|
||||||
handle->shutdown = 0;
|
handle->shutdown = 0;
|
||||||
@ -163,6 +163,7 @@ startMonitor(void *arg,void* opt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
script_error = true;
|
||||||
if(access(params->value,F_OK) == 0)
|
if(access(params->value,F_OK) == 0)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE,
|
skygw_log_write(LE,
|
||||||
@ -175,17 +176,24 @@ startMonitor(void *arg,void* opt)
|
|||||||
"Error: The file cannot be found: %s",
|
"Error: The file cannot be found: %s",
|
||||||
params->value);
|
params->value);
|
||||||
}
|
}
|
||||||
handle->script = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strcmp(params->name,"events"))
|
else if(!strcmp(params->name,"events"))
|
||||||
{
|
{
|
||||||
mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value);
|
if(mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value) != 0)
|
||||||
|
script_error = true;
|
||||||
|
else
|
||||||
have_events = true;
|
have_events = true;
|
||||||
}
|
}
|
||||||
params = params->next;
|
params = params->next;
|
||||||
}
|
}
|
||||||
|
if(script_error)
|
||||||
|
{
|
||||||
|
skygw_log_write(LE,"Error: Errors were found in the script configuration parameters "
|
||||||
|
"for the monitor '%s'. The script will not be used.",mon->name);
|
||||||
|
free(handle->script);
|
||||||
|
handle->script = NULL;
|
||||||
|
}
|
||||||
/** If no specific events are given, enable them all */
|
/** If no specific events are given, enable them all */
|
||||||
if(!have_events)
|
if(!have_events)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -113,7 +113,7 @@ startMonitor(void *arg,void* opt)
|
|||||||
MONITOR* mon = (MONITOR*)arg;
|
MONITOR* mon = (MONITOR*)arg;
|
||||||
MM_MONITOR *handle = mon->handle;
|
MM_MONITOR *handle = mon->handle;
|
||||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||||
bool have_events = false;
|
bool have_events = false,script_error = false;
|
||||||
|
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
@ -148,6 +148,7 @@ startMonitor(void *arg,void* opt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
script_error = true;
|
||||||
if(access(params->value,F_OK) == 0)
|
if(access(params->value,F_OK) == 0)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE,
|
skygw_log_write(LE,
|
||||||
@ -165,11 +166,20 @@ startMonitor(void *arg,void* opt)
|
|||||||
}
|
}
|
||||||
else if(!strcmp(params->name,"events"))
|
else if(!strcmp(params->name,"events"))
|
||||||
{
|
{
|
||||||
mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value);
|
if(mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value) != 0)
|
||||||
|
script_error = true;
|
||||||
|
else
|
||||||
have_events = true;
|
have_events = true;
|
||||||
}
|
}
|
||||||
params = params->next;
|
params = params->next;
|
||||||
}
|
}
|
||||||
|
if(script_error)
|
||||||
|
{
|
||||||
|
skygw_log_write(LE,"Error: Errors were found in the script configuration parameters "
|
||||||
|
"for the monitor '%s'. The script will not be used.",mon->name);
|
||||||
|
free(handle->script);
|
||||||
|
handle->script = NULL;
|
||||||
|
}
|
||||||
/** If no specific events are given, enable them all */
|
/** If no specific events are given, enable them all */
|
||||||
if(!have_events)
|
if(!have_events)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -343,7 +343,10 @@ int mon_parse_event_string(bool* events, size_t count,char* string)
|
|||||||
{
|
{
|
||||||
event = mon_name_to_event(tok);
|
event = mon_name_to_event(tok);
|
||||||
if(event == UNDEFINED_MONITOR_EVENT)
|
if(event == UNDEFINED_MONITOR_EVENT)
|
||||||
|
{
|
||||||
|
skygw_log_write(LE,"Error: Invalid event name %s",tok);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
events[event] = true;
|
events[event] = true;
|
||||||
tok = strtok_r(NULL,",| ",&saved);
|
tok = strtok_r(NULL,",| ",&saved);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,7 +140,7 @@ startMonitor(void *arg, void* opt)
|
|||||||
MONITOR* monitor = (MONITOR*)arg;
|
MONITOR* monitor = (MONITOR*)arg;
|
||||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR*)monitor->handle;
|
MYSQL_MONITOR *handle = (MYSQL_MONITOR*)monitor->handle;
|
||||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||||
bool have_events = false;
|
bool have_events = false,script_error = false;
|
||||||
|
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
@ -176,6 +176,7 @@ startMonitor(void *arg, void* opt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
script_error = true;
|
||||||
if(access(params->value,F_OK) == 0)
|
if(access(params->value,F_OK) == 0)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE,
|
skygw_log_write(LE,
|
||||||
@ -193,11 +194,20 @@ startMonitor(void *arg, void* opt)
|
|||||||
}
|
}
|
||||||
else if(!strcmp(params->name,"events"))
|
else if(!strcmp(params->name,"events"))
|
||||||
{
|
{
|
||||||
mon_parse_event_string(handle->events,sizeof(handle->events),params->value);
|
if(mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value) != 0)
|
||||||
|
script_error = true;
|
||||||
|
else
|
||||||
have_events = true;
|
have_events = true;
|
||||||
}
|
}
|
||||||
params = params->next;
|
params = params->next;
|
||||||
}
|
}
|
||||||
|
if(script_error)
|
||||||
|
{
|
||||||
|
skygw_log_write(LE,"Error: Errors were found in the script configuration parameters "
|
||||||
|
"for the monitor '%s'. The script will not be used.",monitor->name);
|
||||||
|
free(handle->script);
|
||||||
|
handle->script = NULL;
|
||||||
|
}
|
||||||
/** If no specific events are given, enable them all */
|
/** If no specific events are given, enable them all */
|
||||||
if(!have_events)
|
if(!have_events)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -111,7 +111,7 @@ startMonitor(void *arg,void* opt)
|
|||||||
MONITOR* mon = (MONITOR*)arg;
|
MONITOR* mon = (MONITOR*)arg;
|
||||||
MYSQL_MONITOR *handle = mon->handle;
|
MYSQL_MONITOR *handle = mon->handle;
|
||||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||||
bool have_events = false;
|
bool have_events = false,script_error = false;
|
||||||
|
|
||||||
if (handle != NULL)
|
if (handle != NULL)
|
||||||
{
|
{
|
||||||
@ -140,6 +140,7 @@ startMonitor(void *arg,void* opt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
script_error = true;
|
||||||
if(access(params->value,F_OK) == 0)
|
if(access(params->value,F_OK) == 0)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE,
|
skygw_log_write(LE,
|
||||||
@ -157,10 +158,19 @@ startMonitor(void *arg,void* opt)
|
|||||||
}
|
}
|
||||||
else if(!strcmp(params->name,"events"))
|
else if(!strcmp(params->name,"events"))
|
||||||
{
|
{
|
||||||
mon_parse_event_string(&handle->events,sizeof(handle->events),params->value);
|
if(mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value) != 0)
|
||||||
|
script_error = true;
|
||||||
|
else
|
||||||
have_events = true;
|
have_events = true;
|
||||||
}
|
}
|
||||||
params = params->next;
|
params = params->next;
|
||||||
|
}
|
||||||
|
if(script_error)
|
||||||
|
{
|
||||||
|
skygw_log_write(LE,"Error: Errors were found in the script configuration parameters "
|
||||||
|
"for the monitor '%s'. The script will not be used.",mon->name);
|
||||||
|
free(handle->script);
|
||||||
|
handle->script = NULL;
|
||||||
}
|
}
|
||||||
/** If no specific events are given, enable them all */
|
/** If no specific events are given, enable them all */
|
||||||
if(!have_events)
|
if(!have_events)
|
||||||
|
|||||||
Reference in New Issue
Block a user