recoverd: Always do an early exit from main_loop if node is stopped or banned
authorAmitay Isaacs <amitay@gmail.com>
Thu, 27 Jun 2013 05:39:15 +0000 (15:39 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 2 Jul 2013 07:47:05 +0000 (17:47 +1000)
A stopped or banned node cannot do anything useful.  So do not participate
in any cluster activity and do not cause any unnecessary network traffic.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 2396981c4bcf30530aeb7f4395093cc202105b50)

Conflicts:
server/ctdb_recoverd.c

server/ctdb_recoverd.c

index ad91614c18cef84dc18cf71dd4f83d6ff685a053..7f295567d0316f17860d99313d9c618a3fa61257 100644 (file)
@@ -3244,7 +3244,7 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
        /* if the local daemon is STOPPED or BANNED, we verify that the databases are
           also frozen and thet the recmode is set to active.
        */
-       if (nodemap->nodes[pnn].flags & (NODE_FLAGS_STOPPED | NODE_FLAGS_BANNED)) {
+       if (rec->node_flags & (NODE_FLAGS_STOPPED | NODE_FLAGS_BANNED)) {
                ret = ctdb_ctrl_getrecmode(ctdb, mem_ctx, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, &ctdb->recovery_mode);
                if (ret != 0) {
                        DEBUG(DEBUG_ERR,(__location__ " Failed to read recmode from local node\n"));
@@ -3263,9 +3263,15 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 
                                return;
                        }
-                       return;
                }
+
+               /* If this node is stopped or banned then it is not the recovery
+                * master, so don't do anything. This prevents stopped or banned
+                * node from starting election and sending unnecessary controls.
+                */
+               return;
        }
+
        /* If the local node is stopped, verify we are not the recmaster 
           and yield this role if so
        */