Printf format checking added to logging function.

Printf format checking added to logging function and all
issues that were revealed by that fixed.
This commit is contained in:
Johan Wikman 2015-11-16 11:38:03 +02:00
parent 44df53d846
commit a355e1beef
26 changed files with 209 additions and 191 deletions

View File

@ -126,7 +126,7 @@ void mxs_log_set_augmentation(int bits);
int mxs_log_message(int priority,
const char* file, int line, const char* function,
const char* format, ...);
const char* format, ...) __attribute__((format(printf, 5, 6)));
inline int mxs_log_id_to_priority(logfile_id_t id)
{

View File

@ -173,16 +173,16 @@ int main(int argc, char* argv[])
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
logstr = ("First write with flush.");
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
err = skygw_log_write_flush(LOGFILE_ERROR, "%s", logstr);
logstr = ("Second write with flush.");
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
err = skygw_log_write_flush(LOGFILE_ERROR, "%s", logstr);
logstr = ("Third write, no flush.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
logstr = ("Fourth write, no flush. Next flush only.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
err = mxs_log_flush();
@ -196,7 +196,7 @@ int main(int argc, char* argv[])
skygw_log_enable(LOGFILE_TRACE);
#endif
logstr = "My name is Tracey Tracey 47 years and 7 months.";
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
#if !defined(SS_DEBUG)
skygw_log_enable(LOGFILE_TRACE);
#endif
@ -207,12 +207,12 @@ int main(int argc, char* argv[])
skygw_log_enable(LOGFILE_TRACE);
#endif
logstr = "My name is Philip";
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
#if !defined(SS_DEBUG)
skygw_log_enable(LOGFILE_TRACE);
#endif
logstr = "Philip.";
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
#if !defined(SS_DEBUG)
skygw_log_enable(LOGFILE_TRACE);
#endif
@ -221,26 +221,26 @@ int main(int argc, char* argv[])
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
logstr = ("A terrible error has occurred!");
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
err = skygw_log_write_flush(LOGFILE_ERROR, "%s", logstr);
logstr = ("Hi, how are you?");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
logstr = ("I'm doing fine!");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
logstr = ("Rather more surprising, at least at first sight, is the fact that a reference to "
"a[i] can also be written as *(a+i). In evaluating a[i], C converts it to *(a+i) "
"immediately; the two forms are equivalent. Applying the operators & to both parts "
"of this equivalence, it follows that &a[i] and a+i are also identical: a+i is the "
"address of the i-th element beyond a.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
logstr = ("I was wondering, you know, it has been such a lovely weather whole morning and I "
"thought that would you like to come to my place and have a little piece of cheese "
"with us. Just me and my mom - and you, of course. Then, if you wish, we could "
"listen to the radio and keep company for our little Steven, my mom's cat, you know.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
mxs_log_finish();
#if defined(TEST1)
@ -366,63 +366,63 @@ int main(int argc, char* argv[])
skygw_log_enable(LOGFILE_TRACE);
#endif
succp = mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
ss_dassert(succp);
ss_dassert(succp);
logstr = ("\tTEST 3 - test enabling and disabling logs.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
skygw_log_disable(LOGFILE_TRACE);
logstr = ("1.\tWrite once to ERROR and twice to MESSAGE log.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
skygw_log_enable(LOGFILE_TRACE);
logstr = ("2.\tWrite to once to ERROR, twice to MESSAGE and "
"three times to TRACE log.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
skygw_log_disable(LOGFILE_ERROR);
logstr = ("3.\tWrite to once to MESSAGE and twice to TRACE log.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
skygw_log_disable(LOGFILE_MESSAGE);
skygw_log_disable(LOGFILE_TRACE);
logstr = ("4.\tWrite to none.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
skygw_log_enable(LOGFILE_ERROR);
skygw_log_enable(LOGFILE_MESSAGE);
logstr = ("4.\tWrite once to ERROR and twice to MESSAGE log.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
mxs_log_finish();
@ -436,32 +436,32 @@ int main(int argc, char* argv[])
skygw_log_enable(LOGFILE_TRACE);
#endif
logstr = ("\tTEST 4 - test spreading logs down to other logs.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
logstr = ("1.\tWrite to ERROR and thus also to MESSAGE and TRACE logs.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
logstr = ("2.\tWrite to MESSAGE and thus to TRACE logs.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
skygw_log_enable(LOGFILE_TRACE);
logstr = ("3.\tWrite to TRACE log only.");
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
ss_dassert(err == 0);
skygw_log_disable(LOGFILE_MESSAGE);
logstr = ("4.\tWrite to ERROR and thus also to TRACE log. "
"MESSAGE is disabled.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
logstr = ("5.\tThis should not appear anywhere since MESSAGE "
"is disabled.");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
mxs_log_finish();
@ -472,28 +472,28 @@ int main(int argc, char* argv[])
skygw_log_enable(LOGFILE_TRACE);
#endif
logstr = ("6.\tWrite to ERROR and thus also to MESSAGE and TRACE logs.");
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
err = skygw_log_write_flush(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
logstr = ("7.\tWrite to MESSAGE and thus to TRACE logs.");
err = skygw_log_write_flush(LOGFILE_MESSAGE, logstr);
err = skygw_log_write_flush(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
logstr = ("8.\tWrite to TRACE log only.");
skygw_log_enable(LOGFILE_TRACE);
err = skygw_log_write_flush(LOGFILE_TRACE, logstr);
err = skygw_log_write_flush(LOGFILE_TRACE, "%s", logstr);
ss_dassert(err == 0);
skygw_log_disable(LOGFILE_MESSAGE);
logstr = ("9.\tWrite to ERROR and thus also to TRACE log. "
"MESSAGE is disabled");
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
err = skygw_log_write_flush(LOGFILE_ERROR, "%s", logstr);
ss_dassert(err == 0);
logstr = ("10.\tThis should not appear anywhere since MESSAGE is "
"disabled.");
err = skygw_log_write_flush(LOGFILE_MESSAGE, logstr);
err = skygw_log_write_flush(LOGFILE_MESSAGE, "%s", logstr);
ss_dassert(err == 0);
skygw_log_enable(LOGFILE_MESSAGE);
@ -542,7 +542,7 @@ static void* thr_run(void* data)
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
mxs_log_flush();
logstr = ("Hi, how are you?");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
if (err != 0)
{
@ -561,10 +561,10 @@ static void* thr_run(void* data)
TEST_ERROR("Error, log write failed.");
}
ss_dassert(err == 0);
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
logstr = ("Testing. One, two, three\n");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -578,7 +578,7 @@ static void* thr_run(void* data)
#if !defined(SS_DEBUG)
skygw_log_enable(LOGFILE_TRACE);
#endif
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -591,7 +591,7 @@ static void* thr_run(void* data)
"immediately; the two forms are equivalent. Applying the operatos & to both parts "
"of this equivalence, it follows that &a[i] and a+i are also identical: a+i is the "
"address of the i-th element beyond a.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -603,7 +603,7 @@ static void* thr_run(void* data)
mxs_log_finish();
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
logstr = ("..and you?");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -615,7 +615,7 @@ static void* thr_run(void* data)
#if !defined(SS_DEBUG)
skygw_log_enable(LOGFILE_TRACE);
#endif
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -627,7 +627,7 @@ static void* thr_run(void* data)
"immediately; the two forms are equivalent. Applying the operatos & to both parts "
"of this equivalence, it follows that &a[i] and a+i are also identical: a+i is the "
"address of the i-th element beyond a.");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -635,7 +635,7 @@ static void* thr_run(void* data)
ss_dassert(err == 0);
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
logstr = ("..... and you too?");
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
err = skygw_log_write(LOGFILE_MESSAGE, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -651,7 +651,7 @@ static void* thr_run(void* data)
#if !defined(SS_DEBUG)
skygw_log_enable(LOGFILE_TRACE);
#endif
err = skygw_log_write(LOGFILE_TRACE, logstr);
err = skygw_log_write(LOGFILE_TRACE, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -660,7 +660,7 @@ static void* thr_run(void* data)
mxs_log_finish();
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
logstr = ("Testing. One, two, three, four\n");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");
@ -669,7 +669,7 @@ static void* thr_run(void* data)
mxs_log_finish();
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
logstr = ("Testing. One, two, three, .. where was I?\n");
err = skygw_log_write(LOGFILE_ERROR, logstr);
err = skygw_log_write(LOGFILE_ERROR, "%s", logstr);
if (err != 0)
{
TEST_ERROR("Error, log write failed.");

View File

@ -124,11 +124,11 @@ int main(int argc, char** argv)
memset(message + block_size - 1, '\0', 1);
if (interval > 0 && i % interval == 0)
{
err = skygw_log_write_flush(LOGFILE_ERROR, message);
err = skygw_log_write_flush(LOGFILE_ERROR, "%s", message);
}
else
{
err = skygw_log_write(LOGFILE_ERROR, message);
err = skygw_log_write(LOGFILE_ERROR, "%s", message);
}
if (err)
{

View File

@ -281,7 +281,7 @@ static THD* get_or_create_thd_for_parsing(
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Invalid status %d in embedded server. "
"Exiting.")));
"Exiting.", mysql->status)));
goto return_err_with_thd;
}
/** Clear result variables */

View File

@ -153,7 +153,7 @@ char* config_clean_string_list(char* str)
PCRE2_UCHAR errbuf[STRERROR_BUFLEN];
pcre2_get_error_message(re_err, errbuf, sizeof(errbuf));
MXS_ERROR("[%s] Regular expression compilation failed at %d: %s",
__FUNCTION__, err_offset, errbuf);
__FUNCTION__, (int)err_offset, errbuf);
pcre2_code_free(re);
free(dest);
return NULL;

View File

@ -1014,7 +1014,7 @@ int dcb_read_SSL(DCB *dcb,
if (buffer)
{
#ifdef SS_DEBUG
MXS_DEBUG("%lu SSL: Truncated buffer from %d to %d bytes. "
MXS_DEBUG("%lu SSL: Truncated buffer from %d to %ld bytes. "
"Read %d bytes, %d bytes waiting.\n", pthread_self(),
bufsize, GWBUF_LENGTH(buffer), n, b);
@ -1204,10 +1204,8 @@ dcb_write_parameter_check(DCB *dcb, GWBUF *queue)
MXS_DEBUG("%lu [dcb_write] Write aborted to dcb %p because "
"it is in state %s",
pthread_self(),
dcb->stats.n_buffered,
dcb,
STRDCBSTATE(dcb->state),
dcb->fd);
STRDCBSTATE(dcb->state));
gwbuf_free(queue);
return false;
}
@ -1640,12 +1638,7 @@ dcb_drain_writeq_SSL(DCB *dcb)
{
break;
}
MXS_ERROR("Write to dcb failed due to "
"SSL error %d:",
dcb,
STRDCBSTATE(dcb->state),
dcb->fd,
ssl_errno);
MXS_ERROR("Write to dcb failed due to SSL error %d:", ssl_errno);
switch(ssl_errno)
{
case SSL_ERROR_SSL:
@ -1833,7 +1826,7 @@ dcb_maybe_add_persistent(DCB *dcb)
else
{
MXS_DEBUG("%lu [dcb_maybe_add_persistent] Not adding DCB %p to persistent pool, "
"user %s, max for pool %d, error handle called %s, hung flag %s, "
"user %s, max for pool %ld, error handle called %s, hung flag %s, "
"server status %d, pool count %d.\n",
pthread_self(),
dcb,

View File

@ -166,7 +166,7 @@ int externcmd_execute(EXTERNCMD* cmd)
{
cmd->child = pid;
cmd->n_exec++;
MXS_DEBUG("[monitor_exec_cmd] Forked child process %d : %s.", pid, cmd);
MXS_DEBUG("[monitor_exec_cmd] Forked child process %d : %s.", pid, cmd->argv[0]);
}
return rval;

View File

@ -808,7 +808,7 @@ do_http_post(GWBUF *buffer, void *cfg) {
goto cleanup;
}
MXS_INFO("do_http_post() ret_code [%d], HTTP code [%d]",
MXS_INFO("do_http_post() ret_code [%d], HTTP code [%ld]",
ret_code, http_code);
cleanup:

View File

@ -177,7 +177,7 @@ secrets_readKeys(const char* path)
"%s failed. Read %d, expected %d bytes. Error %d, %s.",
secret_file,
len,
sizeof(MAXKEYS),
(int)sizeof(MAXKEYS),
eno,
strerror_r(eno, errbuf, sizeof(errbuf)));
return NULL;

View File

@ -1394,7 +1394,7 @@ createInstance(char **options, FILTER_PARAMETER **params)
if(file_empty)
{
skygw_log_write(LOGFILE_ERROR,"dbfwfilter: File is empty: %s");
skygw_log_write(LOGFILE_ERROR,"dbfwfilter: File is empty: %s", filename);
free(filename);
err = true;
goto retblock;

View File

@ -270,7 +270,7 @@ createInstance(char **options, FILTER_PARAMETER **params)
char errbuffer[1024];
pcre2_get_error_message(errnumber, (PCRE2_UCHAR*) & errbuffer, sizeof(errbuffer));
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"Error: regexfilter: Compiling regular expression '%s' failed at %d: %s\n",
"Error: regexfilter: Compiling regular expression '%s' failed at %lu: %s\n",
my_instance->match, erroffset, errbuffer)));
free_instance(my_instance);
return NULL;

View File

@ -986,7 +986,7 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
#ifdef SS_DEBUG
else
{
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c: [%d] Waiting for a result set from %s session.",
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c: [%ld] Waiting for a result set from %s session.",
my_session->d_id,
branch == PARENT?"parent":"child");
}
@ -1002,7 +1002,7 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
if(my_session->eof[branch] >= min_eof)
{
#ifdef SS_DEBUG
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c [%d] %s received last EOF packet",
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c [%ld] %s received last EOF packet",
my_session->d_id,
branch == PARENT?"parent":"child");
#endif
@ -1051,7 +1051,7 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
{
route = true;
#ifdef SS_DEBUG
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c:[%d] Routing final packet of response set.",my_session->d_id);
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c:[%ld] Routing final packet of response set.",my_session->d_id);
#endif
}
}
@ -1059,7 +1059,7 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
!my_session->waiting[CHILD])
{
#ifdef SS_DEBUG
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c:[%d] Routing single packet response.",my_session->d_id);
skygw_log_write_flush(LOGFILE_DEBUG,"tee.c:[%ld] Routing single packet response.",my_session->d_id);
#endif
route = true;
}
@ -1068,7 +1068,7 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
if(route)
{
#ifdef SS_DEBUG
skygw_log_write_flush(LOGFILE_DEBUG, "tee.c:[%d] Routing buffer '%p' parent(waiting [%s] replies [%d] eof[%d])"
skygw_log_write_flush(LOGFILE_DEBUG, "tee.c:[%ld] Routing buffer '%p' parent(waiting [%s] replies [%d] eof[%d])"
" child(waiting [%s] replies[%d] eof [%d])",
my_session->d_id,
my_session->tee_replybuf,

View File

@ -509,7 +509,7 @@ static MONITOR_SERVERS *build_mysql51_replication_tree(MONITOR *mon)
/* get Slave_IO_Running and Slave_SQL_Running values*/
database->server->slaves[nslaves] = atol(row[0]);
nslaves++;
LOGIF(LD,(skygw_log_write_flush(LD,"Found slave at %s:%d",row[1],row[2])));
LOGIF(LD,(skygw_log_write_flush(LD,"Found slave at %s:%s",row[1],row[2])));
}
database->server->slaves[nslaves] = 0;
}

View File

@ -932,8 +932,8 @@ int gw_read_client_event(
"%lu [gw_read_client_event] after "
"gw_mysql_do_authentication, fd %d, "
"state = MYSQL_AUTH_FAILED.",
protocol->owner_dcb->fd,
pthread_self())));
pthread_self(),
protocol->owner_dcb->fd)));
/**
* Release MYSQL_session since it is not used anymore.
*/
@ -1029,11 +1029,11 @@ int gw_read_client_event(
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [gw_read_client_event] after "
"%lu [gw_read_client_event] after "
"gw_mysql_do_authentication, fd %d, "
"state = MYSQL_AUTH_FAILED.",
protocol->owner_dcb->fd,
pthread_self())));
pthread_self(),
protocol->owner_dcb->fd)));
/**
* Release MYSQL_session since it is not used anymore.
*/

View File

@ -192,8 +192,8 @@ int gw_read_backend_handshake(
"%lu [gw_read_backend_handshake] after "
"dcb_read, fd %d, "
"state = MYSQL_HANDSHAKE_FAILED.",
dcb->fd,
pthread_self())));
pthread_self(),
dcb->fd)));
return 1;
}
@ -210,7 +210,7 @@ int gw_read_backend_handshake(
LOGFILE_DEBUG,
"%lu [gw_receive_backend_auth] Invalid "
"authentication message from backend dcb %p "
"fd %d, ptr[4] = %p, error code %d, msg %s.",
"fd %d, ptr[4] = %d, error code %d, msg %s.",
pthread_self(),
dcb,
dcb->fd,
@ -261,8 +261,7 @@ int gw_read_backend_handshake(
"gw_mysql_get_byte3, fd %d, "
"state = MYSQL_HANDSHAKE_FAILED.",
pthread_self(),
dcb->fd,
pthread_self())));
dcb->fd)));
return 1;
}
@ -286,8 +285,7 @@ int gw_read_backend_handshake(
"gw_decode_mysql_server_handshake, fd %d, "
"state = MYSQL_HANDSHAKE_FAILED.",
pthread_self(),
conn->owner_dcb->fd,
pthread_self())));
conn->owner_dcb->fd)));
while((head = gwbuf_consume(head, GWBUF_LENGTH(head))));
return 1;
}
@ -451,7 +449,7 @@ int gw_receive_backend_auth(
LOGFILE_DEBUG,
"%lu [gw_receive_backend_auth] Invalid "
"authentication message from backend dcb %p "
"fd %d, ptr[4] = %p, error %s, msg %s.",
"fd %d, ptr[4] = %d, error %s, msg %s.",
pthread_self(),
dcb,
dcb->fd,
@ -476,7 +474,7 @@ int gw_receive_backend_auth(
LOGFILE_DEBUG,
"%lu [gw_receive_backend_auth] Invalid "
"authentication message from backend dcb %p "
"fd %d, ptr[4] = %p",
"fd %d, ptr[4] = %d",
pthread_self(),
dcb,
dcb->fd,
@ -485,7 +483,7 @@ int gw_receive_backend_auth(
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Invalid authentication message "
"from backend. Packet type : %p",
"from backend. Packet type : %d",
ptr[4])));
}
/*<
@ -503,7 +501,7 @@ int gw_receive_backend_auth(
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [gw_receive_backend_auth] Read zero bytes from "
"backend dcb %p fd %d in state %s. n %d, head %p, len %d",
"backend dcb %p fd %d in state %s. n %d, head %p, len %ld",
pthread_self(),
dcb,
dcb->fd,
@ -519,7 +517,7 @@ int gw_receive_backend_auth(
LOGIF(LD, (skygw_log_write_flush(
LOGFILE_DEBUG,
"%lu [gw_receive_backend_auth] Reading from backend dcb %p "
"fd %d in state %s failed. n %d, head %p, len %d",
"fd %d in state %s failed. n %d, head %p, len %ld",
pthread_self(),
dcb,
dcb->fd,

View File

@ -469,8 +469,8 @@ char task_name[BLRM_TASK_NAME_LEN+1] = "";
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Warning : invalid heartbeat period %s."
" Setting it to default value %d.",
value, inst->heartbeat )));
" Setting it to default value %ld.",
value, inst->heartbeat)));
} else {
inst->heartbeat = h_val;
}
@ -529,8 +529,9 @@ char task_name[BLRM_TASK_NAME_LEN+1] = "";
if (inst->serverid <= 0) {
skygw_log_write_flush(LOGFILE_ERROR,
"Error : Service %s, server-id is not configured. Please configure it with a unique positive integer value (1..2^32-1)",
service->name, inst->serverid);
"Error : Service %s, server-id is not configured. "
"Please configure it with a unique positive integer value (1..2^32-1)",
service->name);
free(inst);
return NULL;
}
@ -888,7 +889,7 @@ ROUTER_SLAVE *slave = (ROUTER_SLAVE *)router_session;
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"%s: Master %s disconnected after %ld seconds. "
"%d events read,",
"%lu events read,",
router->service->name, router->service->dbref->server->name,
time(0) - router->connect_time, router->stats.n_binlogs_ses)));
LOGIF(LE, (skygw_log_write_flush(
@ -1463,7 +1464,7 @@ unsigned long mysql_errno;
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"%s: Master %s disconnected after %ld seconds. "
"%d events read.",
"%lu events read.",
router->service->name, router->service->dbref->server->name,
time(0) - router->connect_time, router->stats.n_binlogs_ses)));
blr_master_reconnect(router);

View File

@ -281,7 +281,7 @@ int fd;
/* If for any reason the file's length is between 1 and 3 bytes
* then report an error. */
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"%s: binlog file %s has an invalid length %d.",
"%s: binlog file %s has an invalid length %lu.",
router->service->name, path, router->current_pos)));
close(fd);
spinlock_release(&router->binlog_lock);
@ -459,7 +459,7 @@ struct stat statb;
{
case 0:
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
"Reached end of binlog file '%s' at %d.",
"Reached end of binlog file '%s' at %lu.",
file->binlogname, pos)));
/* set ok indicator */
@ -527,7 +527,7 @@ struct stat statb;
{
case 0:
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
"Reached end of binlog file at %d.",
"Reached end of binlog file at %lu.",
pos)));
/* set ok indicator */
@ -904,8 +904,8 @@ int fde_seen = 0;
LOGIF(LM, (skygw_log_write_flush(LOGFILE_MESSAGE,
"Transaction Summary for binlog '%s'\n"
"\t\t\tDescription %17s%17s%17s\n\t\t\t"
"No. of Transactions %16llu\n\t\t\t"
"No. of Events %16llu %16.1f %16llu\n\t\t\t"
"No. of Transactions %16lu\n\t\t\t"
"No. of Events %16lu %16.1f %16lu\n\t\t\t"
"No. of Bytes %16.1f%s%16.1f%s%16.1f%s", router->binlog_name,
"Total", "Average", "Max",
n_transactions, total_events,
@ -1012,7 +1012,7 @@ int fde_seen = 0;
if (hdr.event_type > MAX_EVENT_TYPE_MARIADB10) {
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Invalid MariaDB 10 event type 0x%x. "
"Binlog file is %s, position %d",
"Binlog file is %s, position %llu",
hdr.event_type,
router->binlog_name, pos)));
@ -1022,7 +1022,7 @@ int fde_seen = 0;
if (hdr.event_type > MAX_EVENT_TYPE) {
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Invalid event type 0x%x. "
"Binlog file is %s, position %d",
"Binlog file is %s, position %llu",
hdr.event_type,
router->binlog_name, pos)));
@ -1284,7 +1284,7 @@ int fde_seen = 0;
if(debug)
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
"- Rotate event @ %llu, next file is [%s] @ %llu",
"- Rotate event @ %llu, next file is [%s] @ %lu",
pos, file, new_pos)));
}
@ -1307,7 +1307,7 @@ int fde_seen = 0;
if (pending_transaction > 0) {
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"ERROR: Transaction cannot be @ pos %llu: "
"Another MariaDB 10 transaction (GTID %lu-%lu-%llu)"
"Another MariaDB 10 transaction (GTID %u-%u-%lu)"
" was opened at %llu",
pos, domainid, hdr.serverid, n_sequence, last_known_commit)));
@ -1322,7 +1322,7 @@ int fde_seen = 0;
if (debug)
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
"> MariaDB 10 Transaction (GTID %lu-%lu-%llu)"
"> MariaDB 10 Transaction (GTID %u-%u-%lu)"
" starts @ pos %llu",
domainid, hdr.serverid, n_sequence, pos)));
}
@ -1416,7 +1416,7 @@ int fde_seen = 0;
/* pos and next_pos sanity checks */
if (hdr.next_pos > 0 && hdr.next_pos < pos) {
LOGIF(LT, (skygw_log_write_flush(LOGFILE_TRACE,
"Binlog %s: next pos %llu < pos %llu, truncating to %llu",
"Binlog %s: next pos %u < pos %llu, truncating to %llu",
router->binlog_name,
hdr.next_pos,
pos,
@ -1445,7 +1445,7 @@ int fde_seen = 0;
if (hdr.next_pos > 0 && hdr.next_pos != (pos + hdr.event_size)) {
LOGIF(LT, (skygw_log_write_flush(LOGFILE_TRACE,
"Binlog %s: next pos %llu != (pos %llu + event_size %llu), truncating to %llu",
"Binlog %s: next pos %u != (pos %llu + event_size %u), truncating to %llu",
router->binlog_name,
hdr.next_pos,
pos,
@ -1489,7 +1489,7 @@ int fde_seen = 0;
} else {
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"Current event type %lu @ %llu has nex pos = %llu : exiting", hdr.event_type, pos, hdr.next_pos)));
"Current event type %d @ %llu has nex pos = %u : exiting", hdr.event_type, pos, hdr.next_pos)));
break;
}

View File

@ -397,7 +397,7 @@ char task_name[BLRM_TASK_NAME_LEN + 1] = "";
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR,
"%s: Received error: %u, '%s' from master during '%s' phase "
"%s: Received error: %lu, '%s' from master during '%s' phase "
"of the master state machine.",
router->service->name,
mysql_errno, msg_err,
@ -868,11 +868,11 @@ int n_bufs = -1, pn_bufs = -1;
if ((msg = malloc(len)) == NULL)
{
LOGIF(LE,(skygw_log_write(
LOGFILE_ERROR,
"Insufficient memory to buffer event "
"of %d bytes. Binlog %s @ %d.",
len, router->binlog_name,
router->current_pos)));
LOGFILE_ERROR,
"Insufficient memory to buffer event "
"of %d bytes. Binlog %s @ %lu.",
len, router->binlog_name,
router->current_pos)));
break;
}
@ -892,10 +892,10 @@ int n_bufs = -1, pn_bufs = -1;
if (remainder)
{
LOGIF(LE,(skygw_log_write(
LOGFILE_ERROR,
LOGFILE_ERROR,
"Expected entire message in buffer "
"chain, but failed to create complete "
"message as expected. %s @ %d",
"message as expected. %s @ %lu",
router->binlog_name,
router->current_pos)));
free(msg);
@ -916,7 +916,7 @@ int n_bufs = -1, pn_bufs = -1;
router->stats.n_residuals++;
LOGIF(LD,(skygw_log_write(
LOGFILE_DEBUG,
"Residual data left after %d records. %s @ %d",
"Residual data left after %lu records. %s @ %lu",
router->stats.n_binlogs,
router->binlog_name, router->current_pos)));
break;
@ -967,7 +967,7 @@ int n_bufs = -1, pn_bufs = -1;
LOGIF(LE,(skygw_log_write(
LOGFILE_ERROR,
"Packet length is %d, but event size is %d, "
"binlog file %s position %d "
"binlog file %s position %lu "
"reslen is %d and preslen is %d, "
"length of previous event %d. %s",
len, hdr.event_size,
@ -1033,7 +1033,7 @@ int n_bufs = -1, pn_bufs = -1;
LOGIF(LE,(skygw_log_write(LOGFILE_ERROR,
"%s: Checksum error in event "
"from master, "
"binlog %s @ %d. "
"binlog %s @ %lu. "
"Closing master connection.",
router->service->name,
router->binlog_name,
@ -1091,7 +1091,7 @@ int n_bufs = -1, pn_bufs = -1;
LOGIF(LE,(skygw_log_write_flush(LOGFILE_ERROR,
"Error: a MariaDB 10 transaction "
"is already open "
"@ %lu (GTID %lu-%lu-%llu) and "
"@ %lu (GTID %u-%u-%lu) and "
"a new one starts @ %lu",
router->binlog_position,
domainid, hdr.serverid, n_sequence,
@ -1177,7 +1177,7 @@ int n_bufs = -1, pn_bufs = -1;
// Fake format description message
LOGIF(LD,(skygw_log_write(LOGFILE_DEBUG,
"Replication fake event. "
"Binlog %s @ %d.",
"Binlog %s @ %lu.",
router->binlog_name,
router->current_pos)));
router->stats.n_fakeevents++;
@ -1223,7 +1223,7 @@ int n_bufs = -1, pn_bufs = -1;
LOGIF(LD,(skygw_log_write(
LOGFILE_DEBUG,
"Replication heartbeat. "
"Binlog %s @ %d.",
"Binlog %s @ %lu.",
router->binlog_name,
router->current_pos)));
@ -1359,7 +1359,7 @@ int n_bufs = -1, pn_bufs = -1;
/* Some events have been sent */
LOGIF(LE,(skygw_log_write(LOGFILE_ERROR,
"Some events were not distributed to slaves for a pending transaction "
"in %s at %lu. Last distributed even at %lu, last event from master at %lu",
"in %s at %lu. Last distributed even at %llu, last event from master at %lu",
router->binlog_name,
router->binlog_position,
pos,
@ -1391,7 +1391,7 @@ int n_bufs = -1, pn_bufs = -1;
"Artificial event not written "
"to disk or distributed. "
"Type 0x%x, Length %d, Binlog "
"%s @ %d.",
"%s @ %lu.",
hdr.event_type,
hdr.event_size,
router->binlog_name,
@ -1446,7 +1446,7 @@ int n_bufs = -1, pn_bufs = -1;
spinlock_release(&router->lock);
LOGIF(LE,(skygw_log_write(LOGFILE_ERROR,
"Error packet in binlog stream.%s @ %d.",
"Error packet in binlog stream.%s @ %lu.",
router->binlog_name,
router->current_pos)));
@ -1691,7 +1691,7 @@ int action;
* try to resolve the issue.
*/
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"Slave %d is ahead of expected position %s@%d. "
"Slave %d is ahead of expected position %s@%lu. "
"Expected position %d",
slave->serverid, slave->binlogfile,
(unsigned long)slave->binlog_pos,
@ -1925,7 +1925,7 @@ int event_limit;
if (pos > end_pos)
{
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"Error: Reading saved events, the specified pos %lu "
"Error: Reading saved events, the specified pos %llu "
"is ahead of current pos %lu for file %s",
pos, router->current_pos, router->binlog_name)));
return NULL;
@ -1938,14 +1938,14 @@ int event_limit;
{
case 0:
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
"Reading saved events: reached end of binlog file at %d.", pos)));
"Reading saved events: reached end of binlog file at %llu.", pos)));
break;
case -1:
{
char err_msg[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Error: Reading saved events: failed to read binlog "
"file %s at position %d"
"file %s at position %llu"
" (%s).", router->binlog_name,
pos, strerror_r(errno, err_msg, sizeof(err_msg)))));
@ -1960,7 +1960,7 @@ int event_limit;
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Error: Reading saved events: short read when reading the header. "
"Expected 19 bytes but got %d bytes. "
"Binlog file is %s, position %d",
"Binlog file is %s, position %llu",
n, router->binlog_name, pos)));
break;
}
@ -1981,7 +1981,7 @@ int event_limit;
{
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Error: Reading saved events: invalid event type 0x%x. "
"Binlog file is %s, position %d",
"Binlog file is %s, position %llu",
hdr->event_type,
router->binlog_name, pos)));
return NULL;
@ -1991,7 +1991,7 @@ int event_limit;
{
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Error: Reading saved events: failed to allocate memory for binlog entry, "
"size %d at %d.",
"size %d at %llu.",
hdr->event_size, pos)));
return NULL;
}
@ -2007,14 +2007,14 @@ int event_limit;
{
char err_msg[STRERROR_BUFLEN];
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Error: Reading saved events: the event at %ld in %s. "
"Error: Reading saved events: the event at %llu in %s. "
"%s, expected %d bytes.",
pos, router->binlog_name,
strerror_r(errno, err_msg, sizeof(err_msg)), hdr->event_size - 19)));
} else {
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Error: Reading saved events: short read when reading "
"the event at %ld in %s. "
"the event at %llu in %s. "
"Expected %d bytes got %d bytes.",
pos, router->binlog_name, hdr->event_size - 19, n)));
@ -2023,7 +2023,7 @@ int event_limit;
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Error: Reading saved events: binlog event "
"is close to the end of the binlog file, "
"current file size is %u.", end_pos)));
"current file size is %llu.", end_pos)));
}
}
@ -2155,7 +2155,7 @@ char *event_desc = NULL;
if (router->master_state == BLRM_BINLOGDUMP && router->lastEventReceived > 0) {
if ((t_now - router->stats.lastReply) > (router->heartbeat + BLR_NET_LATENCY_WAIT_TIME)) {
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"ERROR: No event received from master %s:%d in heartbeat period (%d seconds), last event (%s %d) received %lu seconds ago. Assuming connection is dead and reconnecting.",
"ERROR: No event received from master %s:%d in heartbeat period (%lu seconds), last event (%s %d) received %lu seconds ago. Assuming connection is dead and reconnecting.",
router->service->dbref->server->name,
router->service->dbref->server->port,
router->heartbeat,

View File

@ -1988,7 +1988,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
blr_close_binlog(router, slave->file);
if (hkheartbeat - beat1 > 1)
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR, "blr_close_binlog took %d maxscale beats",
LOGFILE_ERROR, "blr_close_binlog took %lu maxscale beats",
hkheartbeat - beat1)));
blr_slave_rotate(router, slave, GWBUF_DATA(record));
beat1 = hkheartbeat;
@ -2025,7 +2025,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
}
if (hkheartbeat - beat1 > 1)
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR, "blr_open_binlog took %d beats",
LOGFILE_ERROR, "blr_open_binlog took %lu beats",
hkheartbeat - beat1)));
}
slave->stats.n_bytes += gwbuf_length(head);
@ -2947,7 +2947,7 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
LOGFILE_ERROR,
"Warning: a transaction is still opened at pos %lu"
" File %s will be truncated. "
"Next binlog file is %s at pos %lu, "
"Next binlog file is %s at pos %d, "
"START SLAVE is required again.",
router->last_safe_pos,
router->prevbinlog,
@ -3334,7 +3334,7 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, char *command, char *error
router->binlog_name)));
}
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "%s: New MASTER_LOG_POS is [%u]",
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "%s: New MASTER_LOG_POS is [%lu]",
router->service->name,
router->current_pos)));
}

View File

@ -192,7 +192,7 @@ int main(int argc, char **argv) {
mxs_log_flush_sync();
LOGIF(LM, (skygw_log_write_flush(LOGFILE_MESSAGE,
"Check retcode: %i, Binlog Pos = %llu", ret, inst->binlog_position)));
"Check retcode: %i, Binlog Pos = %lu", ret, inst->binlog_position)));
mxs_log_flush_sync();
mxs_log_finish();

View File

@ -620,7 +620,7 @@ MAXINFO_TREE *tree;
PARSE_ERROR err;
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
"maxinfo: SQL statement: '%s' for 0x%x.",
"maxinfo: SQL statement: '%s' for 0x%p.",
sql, session->dcb)));
if (strcmp(sql, "select @@version_comment limit 1") == 0)
{

View File

@ -293,7 +293,7 @@ char errmsg[120];
tree->value[80] = 0;
sprintf(errmsg, "Unsupported show command '%s'", tree->value);
maxinfo_send_error(dcb, 0, errmsg);
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE, errmsg)));
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE, "%s", errmsg)));
}
/**
@ -345,7 +345,7 @@ exec_flush(DCB *dcb, MAXINFO_TREE *tree)
}
sprintf(errmsg, "Unsupported flush command '%s'", tree->value);
maxinfo_send_error(dcb, 0, errmsg);
skygw_log_write(LE, errmsg);
skygw_log_write(LE, "%s", errmsg);
}
/**
@ -425,7 +425,7 @@ exec_set(DCB *dcb, MAXINFO_TREE *tree)
}
sprintf(errmsg, "Unsupported set command '%s'", tree->value);
maxinfo_send_error(dcb, 0, errmsg);
skygw_log_write(LE, errmsg);
skygw_log_write(LE, "%s", errmsg);
}
/**
@ -505,7 +505,7 @@ exec_clear(DCB *dcb, MAXINFO_TREE *tree)
}
sprintf(errmsg, "Unsupported clear command '%s'", tree->value);
maxinfo_send_error(dcb, 0, errmsg);
skygw_log_write(LE, errmsg);
skygw_log_write(LE, "%s", errmsg);
}
extern void shutdown_server();
@ -627,7 +627,7 @@ exec_shutdown(DCB *dcb, MAXINFO_TREE *tree)
}
sprintf(errmsg, "Unsupported shutdown command '%s'", tree->value);
maxinfo_send_error(dcb, 0, errmsg);
skygw_log_write(LE, errmsg);
skygw_log_write(LE, "%s", errmsg);
}
/**
@ -735,7 +735,7 @@ exec_restart(DCB *dcb, MAXINFO_TREE *tree)
}
sprintf(errmsg, "Unsupported restart command '%s'", tree->value);
maxinfo_send_error(dcb, 0, errmsg);
skygw_log_write(LE, errmsg);
skygw_log_write(LE, "%s", errmsg);
}
/**

View File

@ -3024,10 +3024,21 @@ static void clientReply (
}
else
{
char* sql = modutil_get_SQL(bref->bref_pending_cmd);
if (sql)
{
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Routing query \"%s\" failed.",
bref->bref_pending_cmd)));
LOGFILE_ERROR,
"Routing query \"%s\" failed.", sql)));
free(sql);
}
else
{
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Failed to route query.")));
}
}
gwbuf_free(bref->bref_pending_cmd);
bref->bref_pending_cmd = NULL;
@ -3123,9 +3134,9 @@ static void bref_clear_state(
if(prev2 <= 0)
{
skygw_log_write(LE,"[%s] Error: negative current operation count in backend %s:%u",
__FUNCTION__,
&bref->bref_backend->backend_server->name,
&bref->bref_backend->backend_server->port);
__FUNCTION__,
bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port);
}
}
}
@ -3154,10 +3165,11 @@ static void bref_set_state(
ss_dassert(prev1 >= 0);
if(prev1 < 0)
{
skygw_log_write(LE,"[%s] Error: negative number of connections waiting for results in backend %s:%u",
__FUNCTION__,
&bref->bref_backend->backend_server->name,
&bref->bref_backend->backend_server->port);
skygw_log_write(LE,"[%s] Error: negative number of connections waiting for "
"results in backend %s:%u",
__FUNCTION__,
bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port);
}
/** Increase global operation count */
prev2 = atomic_add(
@ -3166,9 +3178,9 @@ static void bref_set_state(
if(prev2 < 0)
{
skygw_log_write(LE,"[%s] Error: negative current operation count in backend %s:%u",
__FUNCTION__,
&bref->bref_backend->backend_server->name,
&bref->bref_backend->backend_server->port);
__FUNCTION__,
bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port);
}
}
}
@ -4410,7 +4422,7 @@ static void tracelog_routed_query(
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
pthread_self(),
funcname,
buflen,
(int)buflen,
querystr,
b->backend_server->name,
b->backend_server->port,
@ -4432,7 +4444,7 @@ static void tracelog_routed_query(
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
pthread_self(),
funcname,
buflen,
(int)buflen,
querystr,
b->backend_server->name,
b->backend_server->port,

View File

@ -420,7 +420,8 @@ showdb_response_t parse_showdb_response(ROUTER_CLIENT_SES* rses, backend_ref_t*
{
duplicate_found = true;
skygw_log_write(LE, "Error: Database '%s' found on servers '%s' and '%s' for user %s@%s.",
data, target, hashtable_fetch(rses->shardmap->hash, data),
data, target,
(char*)hashtable_fetch(rses->shardmap->hash, data),
rses->rses_client_dcb->user,
rses->rses_client_dcb->remote);
}
@ -854,7 +855,7 @@ createInstance(SERVICE *service, char **options)
PCRE2_UCHAR errbuf[512];
pcre2_get_error_message(errcode, errbuf, sizeof(errbuf));
skygw_log_write(LE, "Error: Regex compilation failed at %d for regex '%s': %s",
erroffset, param->value, errbuf);
(int)erroffset, param->value, errbuf);
hashtable_free(router->ignored_dbs);
free(router);
return NULL;
@ -2865,10 +2866,21 @@ static void clientReply(ROUTER* instance,
}
else
{
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Routing query \"%s\" failed.",
bref->bref_pending_cmd)));
char* sql = modutil_get_SQL(bref->bref_pending_cmd);
if (sql)
{
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Routing query \"%s\" failed.", sql)));
free(sql);
}
else
{
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Routing query failed.")));
}
}
gwbuf_free(bref->bref_pending_cmd);
bref->bref_pending_cmd = NULL;
@ -2963,9 +2975,9 @@ static void bref_clear_state(
if(prev2 <= 0)
{
skygw_log_write(LE,"[%s] Error: negative current operation count in backend %s:%u",
__FUNCTION__,
&bref->bref_backend->backend_server->name,
&bref->bref_backend->backend_server->port);
__FUNCTION__,
bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port);
}
}
}
@ -2994,10 +3006,11 @@ static void bref_set_state(
ss_dassert(prev1 >= 0);
if(prev1 < 0)
{
skygw_log_write(LE,"[%s] Error: negative number of connections waiting for results in backend %s:%u",
__FUNCTION__,
&bref->bref_backend->backend_server->name,
&bref->bref_backend->backend_server->port);
skygw_log_write(LE,"[%s] Error: negative number of connections waiting "
"for results in backend %s:%u",
__FUNCTION__,
bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port);
}
/** Increase global operation count */
prev2 = atomic_add(
@ -3006,9 +3019,9 @@ static void bref_set_state(
if(prev2 < 0)
{
skygw_log_write(LE,"[%s] Error: negative current operation count in backend %s:%u",
__FUNCTION__,
&bref->bref_backend->backend_server->name,
&bref->bref_backend->backend_server->port);
__FUNCTION__,
bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port);
}
}
}
@ -3785,7 +3798,7 @@ static void tracelog_routed_query(
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
pthread_self(),
funcname,
buflen,
(int)buflen,
querystr,
b->backend_server->name,
b->backend_server->port,
@ -3807,7 +3820,7 @@ static void tracelog_routed_query(
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
pthread_self(),
funcname,
buflen,
(int)buflen,
querystr,
b->backend_server->name,
b->backend_server->port,

View File

@ -146,7 +146,8 @@ bool change_current_db(char* dest,
skygw_log_write_flush(LOGFILE_ERROR,
"change_current_db: failed to change database: Query buffer too large");
skygw_log_write_flush(LOGFILE_TRACE,
"change_current_db: failed to change database: Query buffer too large [%d bytes]",GWBUF_LENGTH(buf));
"change_current_db: failed to change database: "
"Query buffer too large [%ld bytes]", GWBUF_LENGTH(buf));
succp = false;
goto retblock;
}

View File

@ -968,8 +968,8 @@ createInstance(SERVICE *service, char **options)
{
skygw_log_write(LOGFILE_ERROR, "Error : Memory reallocation failed.");
LOGIF(LD,(skygw_log_write(LOGFILE_DEBUG, "shardrouter.c: realloc returned NULL. "
"service count[%d] buffer size [%u] tried to allocate [%u]",
sz, sizeof(SERVICE*)*(sz), sizeof(SERVICE*)*(sz * 2))));
"service count[%d] buffer size [%lu] tried to allocate [%lu]",
sz, sizeof(SERVICE*) * (sz), sizeof(SERVICE*) * (sz * 2))));
free(res_svc);
free(router);
return NULL;