recoverd: Update capabilities only if the current node is active
authorAmitay Isaacs <amitay@gmail.com>
Thu, 27 Jun 2013 05:33:49 +0000 (15:33 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 2 Jul 2013 07:47:05 +0000 (17:47 +1000)
Since we do an early return if a node is stopped or banned, move update
capabilities code below the early return and just before we check the
capabilities of current recovery master.

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

server/ctdb_recoverd.c

index 259dfd9f9c2218812864dc44e5e1471255f9ef36..a9594f566071bd3c7ff27cbe1ae232416d22bbf8 100644 (file)
@@ -3212,13 +3212,6 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
        /* remember our own node flags */
        rec->node_flags = nodemap->nodes[pnn].flags;
 
-       /* update the capabilities for all nodes */
-       ret = update_capabilities(ctdb, nodemap);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR, (__location__ " Unable to update node capabilities.\n"));
-               return;
-       }
-
        /* check which node is the recovery master */
        ret = ctdb_ctrl_getrecmaster(ctdb, mem_ctx, CONTROL_TIMEOUT(), pnn, &rec->recmaster);
        if (ret != 0) {
@@ -3272,6 +3265,13 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
                return;
        }
 
+       /* update the capabilities for all nodes */
+       ret = update_capabilities(ctdb, nodemap);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR, (__location__ " Unable to update node capabilities.\n"));
+               return;
+       }
+
        /*
         * if the current recmaster do not have CTDB_CAP_RECMASTER,
         * but we have force an election and try to become the new