From a5ccf09ac5877c5f4c03c873819c721543bd8f2f Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Wed, 30 Dec 2015 17:57:17 +0200 Subject: [PATCH] Unsafe position is no longer an error The unsafe slave position is no longer an error and will be treated the same way if no events are available i.e. the slaves are no longer disconnected. The log messages now have more information such as the current committed transaction event being processed and the number of events sent by the current thread. --- server/modules/routing/binlog/blr_file.c | 3 +-- server/modules/routing/binlog/blr_slave.c | 17 +++++------------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/server/modules/routing/binlog/blr_file.c b/server/modules/routing/binlog/blr_file.c index a83f0c598..339ec8125 100644 --- a/server/modules/routing/binlog/blr_file.c +++ b/server/modules/routing/binlog/blr_file.c @@ -464,8 +464,7 @@ struct stat statb; { if (pos > router->binlog_position && !router->rotating) { - /* Unsafe position, slave will be disconnected by the calling routine */ - snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "Requested binlog position %lu. Position is unsafe so disconnecting. " + snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "Requested binlog position %lu is unsafe. " "Latest safe position %lu, end of binlog file %lu", pos, router->binlog_position, router->current_pos); diff --git a/server/modules/routing/binlog/blr_slave.c b/server/modules/routing/binlog/blr_slave.c index 8908672b7..26dfd19f1 100644 --- a/server/modules/routing/binlog/blr_slave.c +++ b/server/modules/routing/binlog/blr_slave.c @@ -1962,6 +1962,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; #ifdef BLSLAVE_IN_FILE slave->file = file; #endif + int events_before = slave->stats.n_events; while (burst-- && burst_size > 0 && (record = blr_read_binlog(router, file, slave->binlog_pos, &hdr, read_errmsg)) != NULL) @@ -2103,24 +2104,16 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; if (hdr.ok == SLAVE_POS_READ_UNSAFE) { - MXS_ERROR("%s: Slave %s:%i, server-id %d, binlog '%s', %s", + MXS_NOTICE("%s: Slave %s:%i, server-id %d, binlog '%s', read %d events, " + "current committed transaction event being sent: %lu, %s", router->service->name, slave->dcb->remote, ntohs((slave->dcb->ipv4).sin_port), slave->serverid, slave->binlogfile, + slave->stats.n_events - events_before, + router->current_safe_event, read_errmsg); - - /* - * Close the slave session and socket - * The slave will try to reconnect - */ - dcb_close(slave->dcb); - -#ifndef BLFILE_IN_SLAVE - blr_close_binlog(router, file); -#endif - return 0; } } spinlock_acquire(&slave->catch_lock);