Merge branch 'release-1.0beta-refresh' of https://github.com/skysql/MaxScale into release-1.0beta-refresh
This commit is contained in:
@ -58,6 +58,7 @@ static int authMaxScale(int so, char *user, char *password);
|
|||||||
static int sendCommand(int so, char *cmd);
|
static int sendCommand(int so, char *cmd);
|
||||||
static void DoSource(int so, char *cmd);
|
static void DoSource(int so, char *cmd);
|
||||||
static void DoUsage();
|
static void DoUsage();
|
||||||
|
static int isquit(char *buf);
|
||||||
|
|
||||||
#ifdef HISTORY
|
#ifdef HISTORY
|
||||||
static char *
|
static char *
|
||||||
@ -289,7 +290,7 @@ int argno = 0;
|
|||||||
history(hist, &ev, H_ENTER, buf);
|
history(hist, &ev, H_ENTER, buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!strcasecmp(buf, "quit"))
|
if (isquit(buf))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -552,3 +553,23 @@ DoUsage()
|
|||||||
printf("Any remaining arguments are treated as MaxScale commands or a file\n");
|
printf("Any remaining arguments are treated as MaxScale commands or a file\n");
|
||||||
printf("containing commands to execute.\n");
|
printf("containing commands to execute.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check command to see if it is a quit command
|
||||||
|
*
|
||||||
|
* @param buf The command buffer
|
||||||
|
* @return Non-zero if the command should cause maxadmin to quit
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
isquit(char *buf)
|
||||||
|
{
|
||||||
|
char *ptr = buf;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
return 0;
|
||||||
|
while (*ptr && isspace(*ptr))
|
||||||
|
ptr++;
|
||||||
|
if (strncasecmp(ptr, "quit", 4) == 0 || strncasecmp(ptr, "exit", 4) == 0)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@ -35,6 +35,8 @@
|
|||||||
* 23/05/14 Massimiliano Pinto Added automatic set of maxscale-id: first listening ipv4_raw + port + pid
|
* 23/05/14 Massimiliano Pinto Added automatic set of maxscale-id: first listening ipv4_raw + port + pid
|
||||||
* 28/05/14 Massimiliano Pinto Added detect_replication_lag parameter
|
* 28/05/14 Massimiliano Pinto Added detect_replication_lag parameter
|
||||||
* 28/08/14 Massimiliano Pinto Added detect_stale_master parameter
|
* 28/08/14 Massimiliano Pinto Added detect_stale_master parameter
|
||||||
|
* 12/09/14 Mark Riddoch Addition of checks on servers list and
|
||||||
|
* internal router suppression of messages
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -62,6 +64,7 @@ static int handle_global_item(const char *, const char *);
|
|||||||
static void global_defaults();
|
static void global_defaults();
|
||||||
static void check_config_objects(CONFIG_CONTEXT *context);
|
static void check_config_objects(CONFIG_CONTEXT *context);
|
||||||
static int config_truth_value(char *str);
|
static int config_truth_value(char *str);
|
||||||
|
static int internalService(char *router);
|
||||||
|
|
||||||
static char *config_file = NULL;
|
static char *config_file = NULL;
|
||||||
static GATEWAY_CONF gateway;
|
static GATEWAY_CONF gateway;
|
||||||
@ -605,36 +608,50 @@ int error_count = 0;
|
|||||||
{
|
{
|
||||||
char *servers;
|
char *servers;
|
||||||
char *roptions;
|
char *roptions;
|
||||||
|
char *router;
|
||||||
char *filters = config_get_value(obj->parameters,
|
char *filters = config_get_value(obj->parameters,
|
||||||
"filters");
|
"filters");
|
||||||
servers = config_get_value(obj->parameters, "servers");
|
servers = config_get_value(obj->parameters, "servers");
|
||||||
roptions = config_get_value(obj->parameters,
|
roptions = config_get_value(obj->parameters,
|
||||||
"router_options");
|
"router_options");
|
||||||
|
router = config_get_value(obj->parameters, "router");
|
||||||
if (servers && obj->element)
|
if (servers && obj->element)
|
||||||
{
|
{
|
||||||
char *s = strtok(servers, ",");
|
char *s = strtok(servers, ",");
|
||||||
while (s)
|
while (s)
|
||||||
{
|
{
|
||||||
CONFIG_CONTEXT *obj1 = context;
|
CONFIG_CONTEXT *obj1 = context;
|
||||||
|
int found = 0;
|
||||||
while (obj1)
|
while (obj1)
|
||||||
{
|
{
|
||||||
if (strcmp(trim(s), obj1->object) == 0 &&
|
if (strcmp(trim(s), obj1->object) == 0 &&
|
||||||
obj->element && obj1->element)
|
obj->element && obj1->element)
|
||||||
{
|
{
|
||||||
|
found = 1;
|
||||||
serviceAddBackend(
|
serviceAddBackend(
|
||||||
obj->element,
|
obj->element,
|
||||||
obj1->element);
|
obj1->element);
|
||||||
}
|
}
|
||||||
obj1 = obj1->next;
|
obj1 = obj1->next;
|
||||||
}
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error: Unable to find "
|
||||||
|
"server '%s' that is "
|
||||||
|
"configured as part of "
|
||||||
|
"service '%s'.",
|
||||||
|
s, obj->object)));
|
||||||
|
}
|
||||||
s = strtok(NULL, ",");
|
s = strtok(NULL, ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (servers == NULL)
|
else if (servers == NULL && internalService(router) == 0)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : The service '%s' is missing a "
|
"Warning: The service '%s' is missing a "
|
||||||
"definition of the servers that provide "
|
"definition of the servers that provide "
|
||||||
"the service.",
|
"the service.",
|
||||||
obj->object)));
|
obj->object)));
|
||||||
@ -787,17 +804,29 @@ int error_count = 0;
|
|||||||
while (s)
|
while (s)
|
||||||
{
|
{
|
||||||
CONFIG_CONTEXT *obj1 = context;
|
CONFIG_CONTEXT *obj1 = context;
|
||||||
|
int found = 0;
|
||||||
while (obj1)
|
while (obj1)
|
||||||
{
|
{
|
||||||
if (strcmp(s, obj1->object) == 0 &&
|
if (strcmp(s, obj1->object) == 0 &&
|
||||||
obj->element && obj1->element)
|
obj->element && obj1->element)
|
||||||
{
|
{
|
||||||
|
found = 1;
|
||||||
monitorAddServer(
|
monitorAddServer(
|
||||||
obj->element,
|
obj->element,
|
||||||
obj1->element);
|
obj1->element);
|
||||||
}
|
}
|
||||||
obj1 = obj1->next;
|
obj1 = obj1->next;
|
||||||
}
|
}
|
||||||
|
if (!found)
|
||||||
|
LOGIF(LE,
|
||||||
|
(skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error: Unable to find "
|
||||||
|
"server '%s' that is "
|
||||||
|
"configured in the "
|
||||||
|
"monitor '%s'.",
|
||||||
|
s, obj->object)));
|
||||||
|
|
||||||
s = strtok(NULL, ",");
|
s = strtok(NULL, ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1391,11 +1420,13 @@ SERVER *server;
|
|||||||
while (s)
|
while (s)
|
||||||
{
|
{
|
||||||
CONFIG_CONTEXT *obj1 = context;
|
CONFIG_CONTEXT *obj1 = context;
|
||||||
|
int found = 0;
|
||||||
while (obj1)
|
while (obj1)
|
||||||
{
|
{
|
||||||
if (strcmp(s, obj1->object) == 0 &&
|
if (strcmp(s, obj1->object) == 0 &&
|
||||||
obj->element && obj1->element)
|
obj->element && obj1->element)
|
||||||
{
|
{
|
||||||
|
found = 1;
|
||||||
if (!serviceHasBackend(obj->element, obj1->element))
|
if (!serviceHasBackend(obj->element, obj1->element))
|
||||||
{
|
{
|
||||||
serviceAddBackend(
|
serviceAddBackend(
|
||||||
@ -1405,6 +1436,16 @@ SERVER *server;
|
|||||||
}
|
}
|
||||||
obj1 = obj1->next;
|
obj1 = obj1->next;
|
||||||
}
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error: Unable to find "
|
||||||
|
"server '%s' that is "
|
||||||
|
"configured as part of "
|
||||||
|
"service '%s'.",
|
||||||
|
s, obj->object)));
|
||||||
|
}
|
||||||
s = strtok(NULL, ",");
|
s = strtok(NULL, ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1667,3 +1708,29 @@ config_truth_value(char *str)
|
|||||||
return atoi(str);
|
return atoi(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *InternalRouters[] = {
|
||||||
|
"debugcli",
|
||||||
|
"cli",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the router is one of the special internal services that
|
||||||
|
* MaxScale offers.
|
||||||
|
*
|
||||||
|
* @param router The router name
|
||||||
|
* @return Non-zero if the router is in the InternalRouters table
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
internalService(char *router)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (router)
|
||||||
|
{
|
||||||
|
for (i = 0; InternalRouters[i]; i++)
|
||||||
|
if (strcmp(router, InternalRouters[i]) == 0)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@ -693,8 +693,17 @@ int i;
|
|||||||
service->name)));
|
service->name)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
session->tail = *tail;
|
|
||||||
free(tail);
|
/*
|
||||||
|
* filterUpstream may simply return the 3 parameter if
|
||||||
|
* the filter has no upstream entry point. So no need
|
||||||
|
* to copy the contents or free tail in this case.
|
||||||
|
*/
|
||||||
|
if (tail != &session->tail)
|
||||||
|
{
|
||||||
|
session->tail = *tail;
|
||||||
|
free(tail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -359,7 +359,9 @@ char *server_string;
|
|||||||
/* get server version string */
|
/* get server version string */
|
||||||
server_string = (char *)mysql_get_server_info(database->con);
|
server_string = (char *)mysql_get_server_info(database->con);
|
||||||
if (server_string) {
|
if (server_string) {
|
||||||
database->server->server_string = strdup(server_string);
|
database->server->server_string = realloc(database->server->server_string, strlen(server_string)+1);
|
||||||
|
if (database->server->server_string)
|
||||||
|
strcpy(database->server->server_string, server_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the the Galera FSM shows this node is joined to the cluster */
|
/* Check if the the Galera FSM shows this node is joined to the cluster */
|
||||||
|
|||||||
@ -439,7 +439,9 @@ char *server_string;
|
|||||||
/* get server version string */
|
/* get server version string */
|
||||||
server_string = (char *)mysql_get_server_info(database->con);
|
server_string = (char *)mysql_get_server_info(database->con);
|
||||||
if (server_string) {
|
if (server_string) {
|
||||||
database->server->server_string = strdup(server_string);
|
database->server->server_string = realloc(database->server->server_string, strlen(server_string)+1);
|
||||||
|
if (database->server->server_string)
|
||||||
|
strcpy(database->server->server_string, server_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get server_id form current node */
|
/* get server_id form current node */
|
||||||
|
|||||||
@ -353,7 +353,9 @@ char *server_string;
|
|||||||
/* get server version string */
|
/* get server version string */
|
||||||
server_string = (char *)mysql_get_server_info(database->con);
|
server_string = (char *)mysql_get_server_info(database->con);
|
||||||
if (server_string) {
|
if (server_string) {
|
||||||
database->server->server_string = strdup(server_string);
|
database->server->server_string = realloc(database->server->server_string, strlen(server_string)+1);
|
||||||
|
if (database->server->server_string)
|
||||||
|
strcpy(database->server->server_string, server_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the the SQL node is able to contact one or more data nodes */
|
/* Check if the the SQL node is able to contact one or more data nodes */
|
||||||
|
|||||||
Reference in New Issue
Block a user