ctdb-recovery: Setting up of recmode should be idempotent
authorAmitay Isaacs <amitay@gmail.com>
Thu, 22 Jun 2017 04:49:02 +0000 (14:49 +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

If the recovery mode is already set to the expected value, there is
nothing to do.

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

index 6bed61cd48dcf9101f4c96efb51179ef919f6499..ada31af8822b30a30205c3c38fc3e9b3d808798c 100644 (file)
@@ -856,6 +856,12 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
        struct set_recmode_state *state;
        struct ctdb_cluster_mutex_handle *h;
 
+       if (recmode == ctdb->recovery_mode) {
+               D_INFO("Recovery mode already set to %s\n",
+                      recmode == CTDB_RECOVERY_NORMAL ? "NORMAL" : "ACTIVE");
+               return 0;
+       }
+
        /* if we enter recovery but stay in recovery for too long
           we will eventually drop all our ip addresses
        */