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

@ -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;