recoverd: Also check if current node is in recovery when it is banned
authorAmitay Isaacs <amitay@gmail.com>
Fri, 28 Jun 2013 04:02:44 +0000 (14:02 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 2 Jul 2013 07:44:32 +0000 (17:44 +1000)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 6a9dbb8fb0f1f6e8c206189cdc2d33bb371ea2a8)

server/ctdb_recoverd.c

index 1862248b46a5e6917e2ba98772ae83f439f59653..fe6b2381dc692ee5995bd6b9b474069707baa0d8 100644 (file)
@@ -3235,25 +3235,25 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
                return;
        }
 
-       /* if the local daemon is STOPPED, we verify that the databases are
-          also frozen and thet the recmode is set to active 
+       /* 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) {
+       if (nodemap->nodes[pnn].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"));
                }
                if (ctdb->recovery_mode == CTDB_RECOVERY_NORMAL) {
-                       DEBUG(DEBUG_ERR,("Node is stopped but recovery mode is not active. Activate recovery mode and lock databases\n"));
+                       DEBUG(DEBUG_ERR,("Node is stopped or banned but recovery mode is not active. Activate recovery mode and lock databases\n"));
 
                        ret = ctdb_ctrl_freeze_priority(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, 1);
                        if (ret != 0) {
-                               DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node in STOPPED state\n"));
+                               DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node in STOPPED or BANNED state\n"));
                                return;
                        }
                        ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
                        if (ret != 0) {
-                               DEBUG(DEBUG_ERR,(__location__ " Failed to activate recovery mode in STOPPED state\n"));
+                               DEBUG(DEBUG_ERR,(__location__ " Failed to activate recovery mode in STOPPED or BANNED state\n"));
 
                                return;
                        }