From aabcc4fb12868516f1c5e04507c551529c18b14f Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 15 Apr 2016 10:18:50 +0300 Subject: [PATCH 1/2] Added clarifying comments to event distribution code When a slave transitions from catchup mode to up-to-date mode, it is possible that events are being distributed and the slave appears to be lagging behind. The added comment explain why it happens and how it is handled to make the code clearer. --- server/modules/routing/binlog/blr_master.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index 32fdf61d7..bfcddee76 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -1927,6 +1927,10 @@ blr_distribute_binlog_record(ROUTER_INSTANCE *router, REP_HEADER *hdr, uint8_t * slave->binlogfile, slave->binlog_pos, hdr->next_pos - hdr->event_size); } + /* If none of the above conditions were met, a slave in catchup + * mode transitioned into up-to-date mode while we were + * distributing events. The slave needs to be forced into + * catchup mode since it isn't up to date anymore. */ } else if (rotate) { From 2855389fe22aec7bef7d01202c644f63032ca43b Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 15 Apr 2016 10:37:21 +0300 Subject: [PATCH 2/2] Non-critical errors in binlogrouter are now properly logged as warnings The event distribution error messages were not truly errors but only rare corner cases that usually don't happen. This doesn't mean that they should be treated as errors and treating them as warnings is more helpful. --- server/modules/routing/binlog/blr_master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index bfcddee76..b24bcfa7a 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -1935,7 +1935,7 @@ blr_distribute_binlog_record(ROUTER_INSTANCE *router, REP_HEADER *hdr, uint8_t * else if (rotate) { /** Slave is more than one binlog file behind */ - MXS_ERROR("Slave %s:%d server ID %d is behind more than one binlog file " + MXS_WARNING("Slave %s:%d server ID %d is behind more than one binlog file " "from the master. Slave is using '%s' with position %d " "when master binlog file is '%s'.", slave->dcb->remote, ntohs((slave->dcb->ipv4).sin_port), slave->serverid, @@ -1944,7 +1944,7 @@ blr_distribute_binlog_record(ROUTER_INSTANCE *router, REP_HEADER *hdr, uint8_t * else { /** Slave is lagging behind */ - MXS_ERROR("Slave %s:%d server ID %d is using binlog file '%s' with " + MXS_WARNING("Slave %s:%d server ID %d is using binlog file '%s' with " "position %d. Master binlog file is '%s' at position %lu " "with last safe event at %lu.", slave->dcb->remote, ntohs((slave->dcb->ipv4).sin_port), slave->serverid,