Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA

This commit is contained in:
VilhoRaatikka
2014-12-03 13:28:41 +02:00
5 changed files with 56 additions and 43 deletions

View File

@ -590,11 +590,12 @@ int error_count = 0;
} }
if (obj->element && options) if (obj->element && options)
{ {
char *s = strtok(options, ","); char *lasts;
char *s = strtok_r(options, ",", &lasts);
while (s) while (s)
{ {
filterAddOption(obj->element, s); filterAddOption(obj->element, s);
s = strtok(NULL, ","); s = strtok_r(NULL, ",", &lasts);
} }
} }
if (obj->element) if (obj->element)
@ -640,7 +641,8 @@ int error_count = 0;
router = config_get_value(obj->parameters, "router"); router = config_get_value(obj->parameters, "router");
if (servers && obj->element) if (servers && obj->element)
{ {
char *s = strtok(servers, ","); char *lasts;
char *s = strtok_r(servers, ",", &lasts);
while (s) while (s)
{ {
CONFIG_CONTEXT *obj1 = context; CONFIG_CONTEXT *obj1 = context;
@ -667,7 +669,7 @@ int error_count = 0;
"service '%s'.", "service '%s'.",
s, obj->object))); s, obj->object)));
} }
s = strtok(NULL, ","); s = strtok_r(NULL, ",", &lasts);
} }
} }
else if (servers == NULL && internalService(router) == 0) else if (servers == NULL && internalService(router) == 0)
@ -681,11 +683,12 @@ int error_count = 0;
} }
if (roptions && obj->element) if (roptions && obj->element)
{ {
char *s = strtok(roptions, ","); char *lasts;
char *s = strtok_r(roptions, ",", &lasts);
while (s) while (s)
{ {
serviceAddRouterOption(obj->element, s); serviceAddRouterOption(obj->element, s);
s = strtok(NULL, ","); s = strtok_r(NULL, ",", &lasts);
} }
} }
if (filters && obj->element) if (filters && obj->element)
@ -818,7 +821,7 @@ int error_count = 0;
obj->element = monitor_alloc(obj->object, module); obj->element = monitor_alloc(obj->object, module);
if (servers && obj->element) if (servers && obj->element)
{ {
char *s; char *s, *lasts;
/* if id is not set, compute it now with pid only */ /* if id is not set, compute it now with pid only */
if (gateway.id == 0) { if (gateway.id == 0) {
@ -853,7 +856,7 @@ int error_count = 0;
monitorSetNetworkTimeout(obj->element, MONITOR_WRITE_TIMEOUT, write_timeout); monitorSetNetworkTimeout(obj->element, MONITOR_WRITE_TIMEOUT, write_timeout);
/* get the servers to monitor */ /* get the servers to monitor */
s = strtok(servers, ","); s = strtok_r(servers, ",", &lasts);
while (s) while (s)
{ {
CONFIG_CONTEXT *obj1 = context; CONFIG_CONTEXT *obj1 = context;
@ -880,7 +883,7 @@ int error_count = 0;
"monitor '%s'.", "monitor '%s'.",
s, obj->object))); s, obj->object)));
s = strtok(NULL, ","); s = strtok_r(NULL, ",", &lasts);
} }
} }
if (obj->element && user && passwd) if (obj->element && user && passwd)
@ -1529,7 +1532,8 @@ SERVER *server;
filters = config_get_value(obj->parameters, "filters"); filters = config_get_value(obj->parameters, "filters");
if (servers && obj->element) if (servers && obj->element)
{ {
char *s = strtok(servers, ","); char *lasts;
char *s = strtok_r(servers, ",", &lasts);
while (s) while (s)
{ {
CONFIG_CONTEXT *obj1 = context; CONFIG_CONTEXT *obj1 = context;
@ -1559,17 +1563,18 @@ SERVER *server;
"service '%s'.", "service '%s'.",
s, obj->object))); s, obj->object)));
} }
s = strtok(NULL, ","); s = strtok_r(NULL, ",", &lasts);
} }
} }
if (roptions && obj->element) if (roptions && obj->element)
{ {
char *s = strtok(roptions, ","); char *lasts;
char *s = strtok_r(roptions, ",", &lasts);
serviceClearRouterOptions(obj->element); serviceClearRouterOptions(obj->element);
while (s) while (s)
{ {
serviceAddRouterOption(obj->element, s); serviceAddRouterOption(obj->element, s);
s = strtok(NULL, ","); s = strtok_r(NULL, ",", &lasts);
} }
} }
if (filters && obj->element) if (filters && obj->element)
@ -1667,17 +1672,6 @@ static char *service_params[] =
NULL NULL
}; };
static char *server_params[] =
{
"type",
"address",
"port",
"protocol",
"monitorpw",
"monitoruser",
NULL
};
static char *listener_params[] = static char *listener_params[] =
{ {
"type", "type",

View File

@ -344,8 +344,10 @@ SERVER_PARAM *param;
} }
} }
if (server->node_ts > 0) { if (server->node_ts > 0) {
struct tm result;
char buf[40];
dcb_printf(dcb, "\tLast Repl Heartbeat:\t%s", dcb_printf(dcb, "\tLast Repl Heartbeat:\t%s",
asctime(localtime(&server->node_ts))); asctime_r(localtime_r((time_t *)(&server->node_ts), &result), buf));
} }
if ((param = server->parameters) != NULL) if ((param = server->parameters) != NULL)
{ {

View File

@ -809,13 +809,16 @@ SERVICE *service;
void void
printService(SERVICE *service) printService(SERVICE *service)
{ {
SERVER *ptr = service->databases; SERVER *ptr = service->databases;
int i; struct tm result;
char time_buf[30];
int i;
printf("Service %p\n", service); printf("Service %p\n", service);
printf("\tService: %s\n", service->name); printf("\tService: %s\n", service->name);
printf("\tRouter: %s (%p)\n", service->routerModule, service->router); printf("\tRouter: %s (%p)\n", service->routerModule, service->router);
printf("\tStarted: %s", asctime(localtime(&service->stats.started))); printf("\tStarted: %s",
asctime_r(localtime_r(&service->stats.started, &result), time_buf));
printf("\tBackend databases\n"); printf("\tBackend databases\n");
while (ptr) while (ptr)
{ {
@ -887,8 +890,10 @@ SERVICE *ptr;
*/ */
void dprintService(DCB *dcb, SERVICE *service) void dprintService(DCB *dcb, SERVICE *service)
{ {
SERVER *server = service->databases; SERVER *server = service->databases;
int i; struct tm result;
char timebuf[30];
int i;
dcb_printf(dcb, "Service %p\n", service); dcb_printf(dcb, "Service %p\n", service);
dcb_printf(dcb, "\tService: %s\n", dcb_printf(dcb, "\tService: %s\n",
@ -898,7 +903,7 @@ int i;
if (service->router) if (service->router)
service->router->diagnostics(service->router_instance, dcb); service->router->diagnostics(service->router_instance, dcb);
dcb_printf(dcb, "\tStarted: %s", dcb_printf(dcb, "\tStarted: %s",
asctime(localtime(&service->stats.started))); asctime_r(localtime_r(&service->stats.started, &result), timebuf));
dcb_printf(dcb, "\tRoot user access: %s\n", dcb_printf(dcb, "\tRoot user access: %s\n",
service->enable_root ? "Enabled" : "Disabled"); service->enable_root ? "Enabled" : "Disabled");
if (service->n_filters) if (service->n_filters)

View File

@ -465,11 +465,15 @@ int rval = 0;
void void
printSession(SESSION *session) printSession(SESSION *session)
{ {
struct tm result;
char timebuf[40];
printf("Session %p\n", session); printf("Session %p\n", session);
printf("\tState: %s\n", session_state(session->state)); printf("\tState: %s\n", session_state(session->state));
printf("\tService: %s (%p)\n", session->service->name, session->service); printf("\tService: %s (%p)\n", session->service->name, session->service);
printf("\tClient DCB: %p\n", session->client); printf("\tClient DCB: %p\n", session->client);
printf("\tConnected: %s", asctime(localtime(&session->stats.connect))); printf("\tConnected: %s",
asctime_r(localtime_r(&session->stats.connect, &result), timebuf));
} }
/** /**
@ -566,7 +570,9 @@ int norouter = 0;
void void
dprintAllSessions(DCB *dcb) dprintAllSessions(DCB *dcb)
{ {
SESSION *ptr; struct tm result;
char timebuf[40];
SESSION *ptr;
spinlock_acquire(&session_spin); spinlock_acquire(&session_spin);
ptr = allSessions; ptr = allSessions;
@ -578,7 +584,8 @@ SESSION *ptr;
dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client); dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client);
if (ptr->client && ptr->client->remote) if (ptr->client && ptr->client->remote)
dcb_printf(dcb, "\tClient Address: %s\n", ptr->client->remote); dcb_printf(dcb, "\tClient Address: %s\n", ptr->client->remote);
dcb_printf(dcb, "\tConnected: %s", asctime(localtime(&ptr->stats.connect))); dcb_printf(dcb, "\tConnected: %s",
asctime_r(localtime_r(&ptr->stats.connect, &result), timebuf));
ptr = ptr->next; ptr = ptr->next;
} }
spinlock_release(&session_spin); spinlock_release(&session_spin);
@ -596,7 +603,9 @@ SESSION *ptr;
void void
dprintSession(DCB *dcb, SESSION *ptr) dprintSession(DCB *dcb, SESSION *ptr)
{ {
int i; struct tm result;
char buf[30];
int i;
dcb_printf(dcb, "Session %d (%p)\n",ptr->ses_id, ptr); dcb_printf(dcb, "Session %d (%p)\n",ptr->ses_id, ptr);
dcb_printf(dcb, "\tState: %s\n", session_state(ptr->state)); dcb_printf(dcb, "\tState: %s\n", session_state(ptr->state));
@ -604,7 +613,8 @@ int i;
dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client); dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client);
if (ptr->client && ptr->client->remote) if (ptr->client && ptr->client->remote)
dcb_printf(dcb, "\tClient Address: %s\n", ptr->client->remote); dcb_printf(dcb, "\tClient Address: %s\n", ptr->client->remote);
dcb_printf(dcb, "\tConnected: %s", asctime(localtime(&ptr->stats.connect))); dcb_printf(dcb, "\tConnected: %s",
asctime_r(localtime_r(&ptr->stats.connect, &result), buf));
if (ptr->n_filters) if (ptr->n_filters)
{ {
for (i = 0; i < ptr->n_filters; i++) for (i = 0; i < ptr->n_filters; i++)

View File

@ -423,8 +423,8 @@ init_conn(MQ_INSTANCE *my_instance)
*/ */
char** parse_optstr(char* str, char* tok, int* szstore) char** parse_optstr(char* str, char* tok, int* szstore)
{ {
char* tk = str; char *lasts, *tk = str;
char** arr; char **arr;
int i = 0, size = 1; int i = 0, size = 1;
while((tk = strpbrk(tk + 1,tok))){ while((tk = strpbrk(tk + 1,tok))){
size++; size++;
@ -440,10 +440,10 @@ char** parse_optstr(char* str, char* tok, int* szstore)
} }
*szstore = size; *szstore = size;
tk = strtok(str,tok); tk = strtok_r(str,tok, &lasts);
while(tk && i < size){ while(tk && i < size){
arr[i++] = strdup(tk); arr[i++] = strdup(tk);
tk = strtok(NULL,tok); tk = strtok_r(NULL,tok,&lasts);
} }
return arr; return arr;
} }
@ -1052,7 +1052,8 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
for(z = 0;z<tbsz;z++){ for(z = 0;z<tbsz;z++){
if((tmp = strchr(tblnames[z],'.')) != NULL){ if((tmp = strchr(tblnames[z],'.')) != NULL){
tmp = strtok(tblnames[z],"."); char *lasts;
tmp = strtok_r(tblnames[z],".",&lasts);
for(i = 0; i<my_instance->shm_trg->size; i++){ for(i = 0; i<my_instance->shm_trg->size; i++){
if(strcmp(tmp,my_instance->shm_trg->objects[i]) == 0){ if(strcmp(tmp,my_instance->shm_trg->objects[i]) == 0){
@ -1103,8 +1104,9 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
char* tbnm = NULL; char* tbnm = NULL;
if((strchr(sesstbls[j],'.')) != NULL){ if((strchr(sesstbls[j],'.')) != NULL){
tbnm = strtok(sesstbls[j],"."); char *lasts;
tbnm = strtok(NULL,"."); tbnm = strtok_r(sesstbls[j],".",&lasts);
tbnm = strtok_r(NULL,".",&lasts);
}else{ }else{
tbnm = sesstbls[j]; tbnm = sesstbls[j];
} }