ctdb-recoverd: Move takeover run checks after recover checks
authorMartin Schwenke <martin@meltin.net>
Tue, 3 May 2016 06:00:02 +0000 (16:00 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 13 May 2016 11:47:17 +0000 (13:47 +0200)
If a recovery is going to be done then this will be followed by a
takeover run anyway.  So, there's no use doing the takeover run
checks, potentially doing a takeover run and then doing a recovery.

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

index 4df57c5b79a2949864eac06501a241fbbe0e1632..f7f8fab14a69ce988223e8b98a8e652e39167721 100644 (file)
@@ -3653,18 +3653,12 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
        }
 
 
-       /* if there are takeovers requested, perform it and notify the waiters */
-       if (!ctdb_op_is_disabled(rec->takeover_run) &&
-           rec->reallocate_requests) {
-               process_ipreallocate_requests(ctdb, rec);
-       }
-
        /* If recoveries are disabled then there is no use doing any
         * nodemap or flags checks.  Recoveries might be disabled due
         * to "reloadnodes", so doing these checks might cause an
         * unnecessary recovery.  */
        if (ctdb_op_is_disabled(rec->recovery)) {
-               return;
+               goto takeover_run_checks;
        }
 
        /* get the nodemap for all active remote nodes
@@ -3873,6 +3867,14 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
                }
        }
 
+takeover_run_checks:
+
+       /* if there are takeovers requested, perform it and notify the waiters */
+       if (!ctdb_op_is_disabled(rec->takeover_run) &&
+           rec->reallocate_requests) {
+               process_ipreallocate_requests(ctdb, rec);
+       }
+
        /* we might need to change who has what IP assigned */
        if (rec->need_takeover_run) {
                /* If takeover run fails, then the offending nodes are