ctdb-tool: Update "reloadnodes" to disable recoveries
authorMartin Schwenke <martin@meltin.net>
Mon, 9 Feb 2015 09:20:44 +0000 (20:20 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 7 Apr 2015 05:43:13 +0000 (07:43 +0200)
If a recovery occurs when some nodes have reloaded and others haven't
then the nodemaps with be inconsistent so bad things will happen.

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

index 2c906a5423ea096c2769d4107edaa6cbeff291e8..c1014956b212b38e68e150dc735d5b451179d8a3 100644 (file)
@@ -6361,6 +6361,7 @@ static int control_reload_nodes_file(struct ctdb_context *ctdb, int argc, const
        TALLOC_CTX *tmp_ctx = talloc_new(NULL);
        struct ctdb_node_map *file_nodemap;
        uint32_t *conn;
+       uint32_t timeout;
 
        assert_current_node_only(ctdb);
 
@@ -6400,12 +6401,24 @@ static int control_reload_nodes_file(struct ctdb_context *ctdb, int argc, const
                                     conn[i]));
        }
 
+       /* Another timeout could be used, such as ReRecoveryTimeout or
+        * a new one for this purpose.  However, this is the simplest
+        * option. */
+       timeout = options.timelimit;
+       srvid_broadcast(ctdb, CTDB_SRVID_DISABLE_RECOVERIES, &timeout,
+                       "Disable recoveries", true);
+
+
        ret = ctdb_client_async_control(ctdb, CTDB_CONTROL_RELOAD_NODES_FILE,
                                        conn, 0, TIMELIMIT(),
                                        true, tdb_null,
                                        NULL, reload_nodes_fail_callback,
                                        NULL);
 
+       timeout = 0;
+       srvid_broadcast(ctdb, CTDB_SRVID_DISABLE_RECOVERIES, &timeout,
+                       "Enable recoveries", true);
+
        /* initiate a recovery */
        control_recover(ctdb, argc, argv);