ctdb-recoverd: Drop code to freeze databases from set_recovery_mode()
authorAmitay Isaacs <amitay@gmail.com>
Tue, 13 Sep 2016 05:45:54 +0000 (15:45 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 14 Sep 2016 06:39:28 +0000 (08:39 +0200)
This function is called only once from force_election() and does not
require freezing of databases.

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

index ba4d8a21f019d0393ed93f9240df82975e04d9b4..92ba35f33103582667b6ce7fed89320098b5c72b 100644 (file)
@@ -385,21 +385,13 @@ static int update_capabilities(struct ctdb_recoverd *rec,
        return 0;
 }
 
-static void set_recmode_fail_callback(struct ctdb_context *ctdb, uint32_t node_pnn, int32_t res, TDB_DATA outdata, void *callback_data)
-{
-       struct ctdb_recoverd *rec = talloc_get_type(callback_data, struct ctdb_recoverd);
-
-       DEBUG(DEBUG_ERR,("Failed to freeze node %u during recovery. Set it as ban culprit for %d credits\n", node_pnn, rec->nodemap->num));
-       ctdb_set_culprit_count(rec, node_pnn, rec->nodemap->num);
-}
-
 /*
   change recovery mode on all nodes
  */
 static int set_recovery_mode(struct ctdb_context *ctdb,
                             struct ctdb_recoverd *rec,
                             struct ctdb_node_map_old *nodemap,
-                            uint32_t rec_mode, bool freeze)
+                            uint32_t rec_mode)
 {
        TDB_DATA data;
        uint32_t *nodes;
@@ -424,25 +416,6 @@ static int set_recovery_mode(struct ctdb_context *ctdb,
                return -1;
        }
 
-       /* freeze all nodes */
-       if (freeze && rec_mode == CTDB_RECOVERY_ACTIVE) {
-               int i;
-
-               for (i=1; i<=NUM_DB_PRIORITIES; i++) {
-                       if (ctdb_client_async_control(ctdb, CTDB_CONTROL_FREEZE,
-                                               nodes, i,
-                                               CONTROL_TIMEOUT(),
-                                               false, tdb_null,
-                                               NULL,
-                                               set_recmode_fail_callback,
-                                               rec) != 0) {
-                               DEBUG(DEBUG_ERR, (__location__ " Unable to freeze nodes. Recovery failed.\n"));
-                               talloc_free(tmp_ctx);
-                               return -1;
-                       }
-               }
-       }
-
        talloc_free(tmp_ctx);
        return 0;
 }
@@ -1901,7 +1874,7 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
        DEBUG(DEBUG_INFO,(__location__ " Force an election\n"));
 
        /* set all nodes to recovery mode to stop all internode traffic */
-       ret = set_recovery_mode(ctdb, rec, nodemap, CTDB_RECOVERY_ACTIVE, false);
+       ret = set_recovery_mode(ctdb, rec, nodemap, CTDB_RECOVERY_ACTIVE);
        if (ret != 0) {
                DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
                return;