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)
committerMichael Adam <obnox@samba.org>
Mon, 26 Aug 2013 11:35:52 +0000 (13:35 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 6a9dbb8fb0f1f6e8c206189cdc2d33bb371ea2a8)

server/ctdb_recoverd.c

index 5bc44c48aab868ab59e445502133d257bf483f2c..c8c26f19b95f888265752ad260ec95b91fdbb8f9 100644 (file)
@@ -2981,25 +2981,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;
                        }