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:
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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)));
|
||||
}
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user