ctdb-recoverd: Update flags on all nodes before database recovery
authorAmitay Isaacs <amitay@gmail.com>
Thu, 17 Sep 2015 07:10:15 +0000 (17:10 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 7 Oct 2015 12:53:29 +0000 (14:53 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_recoverd.c

index 5ae887035b387741d9679106a9526f1ca12af545..d85967afa5afee24a7380602c9f468d769ace747 100644 (file)
@@ -1824,27 +1824,6 @@ static int db_recovery_serial(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx,
                return -1;
        }
 
-       /*
-         update all nodes to have the same flags that we have
-        */
-       for (i=0;i<nodemap->num;i++) {
-               if (nodemap->nodes[i].flags & NODE_FLAGS_DISCONNECTED) {
-                       continue;
-               }
-
-               ret = update_flags_on_all_nodes(ctdb, nodemap, i, nodemap->nodes[i].flags);
-               if (ret != 0) {
-                       if (nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE) {
-                               DEBUG(DEBUG_WARNING, (__location__ "Unable to update flags on inactive node %d\n", i));
-                       } else {
-                               DEBUG(DEBUG_ERR, (__location__ " Unable to update flags on all nodes for node %d\n", i));
-                               return -1;
-                       }
-               }
-       }
-
-       DEBUG(DEBUG_NOTICE, (__location__ " Recovery - updated flags\n"));
-
        /* pick a new generation number */
        generation = new_generation();
 
@@ -2098,6 +2077,27 @@ static int do_recovery(struct ctdb_recoverd *rec,
                return -1;
        }
 
+       /*
+         update all nodes to have the same flags that we have
+        */
+       for (i=0;i<nodemap->num;i++) {
+               if (nodemap->nodes[i].flags & NODE_FLAGS_DISCONNECTED) {
+                       continue;
+               }
+
+               ret = update_flags_on_all_nodes(ctdb, nodemap, i, nodemap->nodes[i].flags);
+               if (ret != 0) {
+                       if (nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE) {
+                               DEBUG(DEBUG_WARNING, (__location__ "Unable to update flags on inactive node %d\n", i));
+                       } else {
+                               DEBUG(DEBUG_ERR, (__location__ " Unable to update flags on all nodes for node %d\n", i));
+                               return -1;
+                       }
+               }
+       }
+
+       DEBUG(DEBUG_NOTICE, (__location__ " Recovery - updated flags\n"));
+
        ret = db_recovery_serial(rec, mem_ctx, pnn, nodemap, vnnmap, dbmap);
        if (ret != 0) {
                goto fail;