From 97248de3a965b333c341724aecf08cb81d676eed Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 6 Jul 2012 20:36:48 +1000 Subject: recoverd: An inactive node should not force recovery master elections An inactive node can't become the recovery master. So if an inactive node notices that the recovery master is inactive, it shouldn't force an election for recovery master and nominate itself as a candidate. This can cause the recovery master to flip-flop between nodes when all nodes are inactive. If there is actually an active node then it will trigger the election. This is fairly cosmetic but is a step along the way towards ironing out weirdness when all nodes are stopped. Also, fix a related comment. Signed-off-by: Martin Schwenke (This used to be ctdb commit e7dc10da3ced54ea9d719ad167ee42dcca8dce75) --- ctdb/server/ctdb_recoverd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 9608774dbd..11b516a271 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -3387,7 +3387,7 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec, return; } - /* grap the nodemap from the recovery master to check if it is banned */ + /* get nodemap from the recovery master to check if it is inactive */ ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, mem_ctx, &recmaster_nodemap); if (ret != 0) { @@ -3397,7 +3397,8 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec, } - if (recmaster_nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) { + if ((recmaster_nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) && + (rec->node_flags & NODE_FLAGS_INACTIVE) == 0) { DEBUG(DEBUG_NOTICE, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].pnn)); force_election(rec, pnn, nodemap); return; -- cgit