summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctdb/server/ctdb_banning.c2
-rw-r--r--ctdb/server/ctdb_recoverd.c42
2 files changed, 22 insertions, 22 deletions
diff --git a/ctdb/server/ctdb_banning.c b/ctdb/server/ctdb_banning.c
index 13d97c84b1..a9d18910a0 100644
--- a/ctdb/server/ctdb_banning.c
+++ b/ctdb/server/ctdb_banning.c
@@ -70,11 +70,11 @@ void ctdb_local_node_got_banned(struct ctdb_context *ctdb)
*/
ctdb->vnn_map->generation = INVALID_GENERATION;
+ ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
for (i=1; i<=NUM_DB_PRIORITIES; i++) {
ctdb_start_freeze(ctdb, i);
}
ctdb_release_all_ips(ctdb);
- ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
}
int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata)
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index f553f67715..ab73e884c2 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -379,8 +379,23 @@ static int set_recovery_mode(struct ctdb_context *ctdb, struct ctdb_recoverd *re
tmp_ctx = talloc_new(ctdb);
CTDB_NO_MEMORY(ctdb, tmp_ctx);
- /* freeze all nodes */
nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
+
+ data.dsize = sizeof(uint32_t);
+ data.dptr = (unsigned char *)&rec_mode;
+
+ if (ctdb_client_async_control(ctdb, CTDB_CONTROL_SET_RECMODE,
+ nodes, 0,
+ CONTROL_TIMEOUT(),
+ false, data,
+ NULL, NULL,
+ NULL) != 0) {
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode. Recovery failed.\n"));
+ talloc_free(tmp_ctx);
+ return -1;
+ }
+
+ /* freeze all nodes */
if (rec_mode == CTDB_RECOVERY_ACTIVE) {
int i;
@@ -399,21 +414,6 @@ static int set_recovery_mode(struct ctdb_context *ctdb, struct ctdb_recoverd *re
}
}
-
- data.dsize = sizeof(uint32_t);
- data.dptr = (unsigned char *)&rec_mode;
-
- if (ctdb_client_async_control(ctdb, CTDB_CONTROL_SET_RECMODE,
- nodes, 0,
- CONTROL_TIMEOUT(),
- false, data,
- NULL, NULL,
- NULL) != 0) {
- DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode. Recovery failed.\n"));
- talloc_free(tmp_ctx);
- return -1;
- }
-
talloc_free(tmp_ctx);
return 0;
}
@@ -3654,17 +3654,17 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
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"));
- ret = ctdb_ctrl_freeze_priority(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, 1);
- if (ret != 0) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node in STOPPED or BANNED state\n"));
- return;
- }
ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
if (ret != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to activate recovery mode in STOPPED or BANNED state\n"));
return;
}
+ ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node in STOPPED or BANNED state\n"));
+ return;
+ }
}
/* If this node is stopped or banned then it is not the recovery