Merge remote-tracking branch 'origin/develop' into MXS-329

Conflicts:
	server/core/session.c
This commit is contained in:
counterpoint
2015-09-10 13:07:27 +01:00
69 changed files with 3037 additions and 2062 deletions

View File

@ -854,7 +854,8 @@ struct tm tm;
if (router_inst->lastEventTimestamp)
{
localtime_r((const time_t*)&router_inst->lastEventTimestamp, &tm);
time_t last_event = (time_t)router_inst->lastEventTimestamp;
localtime_r(&last_event, &tm);
asctime_r(&tm, buf);
dcb_printf(dcb, "\tLast binlog event timestamp: %ld (%s)\n",
router_inst->lastEventTimestamp, buf);
@ -982,7 +983,8 @@ struct tm tm;
if (session->lastEventTimestamp
&& router_inst->lastEventTimestamp)
{
localtime_r((const time_t*)&session->lastEventTimestamp, &tm);
time_t session_last_event = (time_t)session->lastEventTimestamp;
localtime_r(&session_last_event, &tm);
asctime_r(&tm, buf);
dcb_printf(dcb, "\t\tLast binlog event timestamp %u, %s", session->lastEventTimestamp, buf);
dcb_printf(dcb, "\t\tSeconds behind master %u\n", router_inst->lastEventTimestamp - session->lastEventTimestamp);
@ -1082,7 +1084,7 @@ errorReply(ROUTER *instance, void *router_session, GWBUF *message, DCB *backend_
ROUTER_INSTANCE *router = (ROUTER_INSTANCE *)instance;
int error;
socklen_t len;
char msg[85], *errmsg;
char msg[STRERROR_BUFLEN + 1], *errmsg;
/** Don't handle same error twice on same DCB */
if (backend_dcb->dcb_errhandle_called)
@ -1099,8 +1101,8 @@ char msg[85], *errmsg;
len = sizeof(error);
if (router->master && getsockopt(router->master->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0 && error != 0)
{
strerror_r(error, msg, 80);
strcat(msg, " ");
char errbuf[STRERROR_BUFLEN];
sprintf(msg, "%s ", strerror_r(error, errbuf, sizeof(errbuf)));
}
else
strcpy(msg, "");

View File

@ -950,7 +950,7 @@ int n_bufs = -1, pn_bufs = -1;
return;
}
}
router->stats.n_binlogs++;
router->lastEventReceived = hdr.event_type;
router->lastEventTimestamp = hdr.timestamp;

View File

@ -1464,7 +1464,7 @@ static void fail_accept(
{
int failcount = MIN(atoi(arg2), 100);
fail_accept_errno = atoi(arg1);
char errbuf[STRERROR_BUFLEN];
switch(fail_accept_errno) {
case EAGAIN:
@ -1486,7 +1486,7 @@ static void fail_accept(
dcb_printf(dcb,
"[%d, %s] is not valid errno for accept.\n",
fail_accept_errno,
strerror(fail_accept_errno));
strerror_r(fail_accept_errno, errbuf, sizeof(errbuf)));
return ;
}
}

View File

@ -1443,7 +1443,8 @@ static route_target_t get_route_target (
{
target = TARGET_SLAVE;
}
else if (QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) ||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) ||
QUERY_IS_TYPE(qtype, QUERY_TYPE_EXEC_STMT) ||
/** Configured not to allow reading variables from slaves */
(use_sql_variables_in == TYPE_MASTER &&
@ -2587,8 +2588,8 @@ static bool route_single_stmt(
rses_end_locked_router_action(rses);
goto retblock;
}
GWBUF* wbuf = gwbuf_clone(querybuf);
if ((ret = target_dcb->func.write(target_dcb, wbuf)) == 1)
if ((ret = target_dcb->func.write(target_dcb, gwbuf_clone(querybuf))) == 1)
{
backend_ref_t* bref;
@ -2602,7 +2603,6 @@ static bool route_single_stmt(
}
else
{
gwbuf_free(wbuf);
LOGIF((LE|LT), (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Routing query failed.")));

View File

@ -610,9 +610,11 @@ char** tokenize_string(char* str)
char** tmp = realloc(list,sizeof(char*)*(sz*2));
if(tmp == NULL)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : realloc returned NULL: %s.",strerror(errno))));
LOGFILE_ERROR,
"Error : realloc returned NULL: %s.",
strerror_r(errno, errbuf, sizeof(errbuf)))));
free(list);
return NULL;
}

View File

@ -567,9 +567,11 @@ tokenize_string(char* str)
char** tmp = realloc(list, sizeof(char*)*(sz * 2));
if(tmp == NULL)
{
char errbuf[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : realloc returned NULL: %s.", strerror(errno))));
"Error : realloc returned NULL: %s.",
strerror_r(errno, errbuf, sizeof(errbuf)))));
free(list);
return NULL;
}