ctdb-recovery: Get recmode unconditionally in the main_loop
authorAmitay Isaacs <amitay@gmail.com>
Thu, 22 Jun 2017 07:45:20 +0000 (17:45 +1000)
committerMartin Schwenke <martins@samba.org>
Sat, 24 Jun 2017 08:28:21 +0000 (10:28 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12857

This can be used later in the main_loop to avoid the local ip check.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_recoverd.c

index 751a08eb1592689ca531159431348191f715a924..35b8d4248ffc64148519df000504a108d87ef59d 100644 (file)
@@ -2608,6 +2608,13 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
                return;
        }
 
+       ret = ctdb_ctrl_getrecmode(ctdb, mem_ctx, CONTROL_TIMEOUT(),
+                                  CTDB_CURRENT_NODE, &ctdb->recovery_mode);
+       if (ret != 0) {
+               D_ERR("Failed to read recmode from local node\n");
+               return;
+       }
+
        /* if the local daemon is STOPPED or BANNED, we verify that the databases are
           also frozen and that the recmode is set to active.
        */
@@ -2620,10 +2627,6 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
                 */
                rec->priority_time = timeval_current();
 
-               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 or banned but recovery mode is not active. Activate recovery mode and lock databases\n"));