From 47317e240169f89eba9820ae5f6ae65d300d8af4 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Wed, 24 Aug 2016 17:55:42 +0200 Subject: [PATCH] Event notification to slaves: code review Event notification to slaves: code review update --- server/modules/routing/binlog/blr_master.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index 52b27ce10..c4d8f12fa 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -111,7 +111,7 @@ extern bool blr_notify_waiting_slave(ROUTER_SLAVE *slave); static int keepalive = 1; -/** Transactio-Safety feature */ +/** Transaction-Safety feature */ typedef enum { BLRM_NO_TRANSACTION, /*< No transaction */ @@ -2733,29 +2733,24 @@ void blr_notify_all_slaves(ROUTER_INSTANCE *router) { ROUTER_SLAVE *slave; int notified = 0; - + spinlock_acquire(&router->lock); slave = router->slaves; while (slave) { - if (slave->state != BLRS_DUMPING) - { - slave = slave->next; - continue; - } - /* Notify a slave that has CS_WAIT_DATA bit set */ - if (blr_notify_waiting_slave(slave)) + if (slave->state == BLRS_DUMPING && + blr_notify_waiting_slave(slave)) { notified++; } - + slave = slave->next; } spinlock_release(&router->lock); - + if (notified > 0) { - MXS_BEBUG("Notified %d slaves about new data.", notified); + MXS_DEBUG("Notified %d slaves about new data.", notified); } }