summaryrefslogtreecommitdiff
path: root/ctdb/server
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2015-10-16 14:45:28 +1100
committerMartin Schwenke <martins@samba.org>2015-10-16 09:31:34 +0200
commit5aab31a39a3589b910a78b96071d6aa5e6547696 (patch)
treed8abc5df870089b6d71cf93a267c52def9181958 /ctdb/server
parent30460fc45ef7414ae6e23683f60d64edd5d3e9dc (diff)
downloadsamba-5aab31a39a3589b910a78b96071d6aa5e6547696.tar.gz
ctdb-recovery: Update vnnmap before database recovery
Once the databases are recovered, all the pending calls are resent. If the vnnmap is not updated, then the nodes can redirect calls to nodes that are not part of the new vnnmap. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Oct 16 09:31:34 CEST 2015 on sn-devel-104
Diffstat (limited to 'ctdb/server')
-rw-r--r--ctdb/server/ctdb_recovery_helper.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/ctdb/server/ctdb_recovery_helper.c b/ctdb/server/ctdb_recovery_helper.c
index 194b373ad0b..6d6a835300d 100644
--- a/ctdb/server/ctdb_recovery_helper.c
+++ b/ctdb/server/ctdb_recovery_helper.c
@@ -1213,9 +1213,9 @@ static bool db_recovery_recv(struct tevent_req *req, int *count)
* - Get dbmap
* - Set RECOVERY_ACTIVE
* - Send START_RECOVERY
+ * - Update vnnmap on all nodes
* - Run database recovery
* - Send END_RECOVERY
- * - Update vnnmap on all nodes
* - Set RECOVERY_NORMAL
*/
@@ -1240,8 +1240,8 @@ static void recovery_tunables_done(struct tevent_req *subreq);
static void recovery_dbmap_done(struct tevent_req *subreq);
static void recovery_active_done(struct tevent_req *subreq);
static void recovery_start_recovery_done(struct tevent_req *subreq);
-static void recovery_db_recovery_done(struct tevent_req *subreq);
static void recovery_vnnmap_update_done(struct tevent_req *subreq);
+static void recovery_db_recovery_done(struct tevent_req *subreq);
static void recovery_normal_done(struct tevent_req *subreq);
static void recovery_end_recovery_done(struct tevent_req *subreq);
@@ -1600,6 +1600,7 @@ static void recovery_start_recovery_done(struct tevent_req *subreq)
subreq, struct tevent_req);
struct recovery_state *state = tevent_req_data(
req, struct recovery_state);
+ struct ctdb_req_control request;
int *err_list;
int ret;
bool status;
@@ -1627,36 +1628,6 @@ static void recovery_start_recovery_done(struct tevent_req *subreq)
LOG("start_recovery event finished\n");
- subreq = db_recovery_send(state, state->ev, state->client,
- state->dbmap, state->tun_list,
- state->pnn_list, state->count,
- state->vnnmap->generation);
- if (tevent_req_nomem(subreq, req)) {
- return;
- }
- tevent_req_set_callback(subreq, recovery_db_recovery_done, req);
-}
-
-static void recovery_db_recovery_done(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(
- subreq, struct tevent_req);
- struct recovery_state *state = tevent_req_data(
- req, struct recovery_state);
- struct ctdb_req_control request;
- bool status;
- int count;
-
- status = db_recovery_recv(subreq, &count);
- TALLOC_FREE(subreq);
-
- LOG("%d databases recovered\n", count);
-
- if (! status) {
- tevent_req_error(req, EIO);
- return;
- }
-
ctdb_req_control_setvnnmap(&request, state->vnnmap);
subreq = ctdb_client_control_multi_send(state, state->ev,
state->client,
@@ -1674,7 +1645,6 @@ static void recovery_vnnmap_update_done(struct tevent_req *subreq)
subreq, struct tevent_req);
struct recovery_state *state = tevent_req_data(
req, struct recovery_state);
- struct ctdb_req_control request;
int *err_list;
int ret;
bool status;
@@ -1701,6 +1671,36 @@ static void recovery_vnnmap_update_done(struct tevent_req *subreq)
LOG("updated VNNMAP\n");
+ subreq = db_recovery_send(state, state->ev, state->client,
+ state->dbmap, state->tun_list,
+ state->pnn_list, state->count,
+ state->vnnmap->generation);
+ if (tevent_req_nomem(subreq, req)) {
+ return;
+ }
+ tevent_req_set_callback(subreq, recovery_db_recovery_done, req);
+}
+
+static void recovery_db_recovery_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct recovery_state *state = tevent_req_data(
+ req, struct recovery_state);
+ struct ctdb_req_control request;
+ bool status;
+ int count;
+
+ status = db_recovery_recv(subreq, &count);
+ TALLOC_FREE(subreq);
+
+ LOG("%d databases recovered\n", count);
+
+ if (! status) {
+ tevent_req_error(req, EIO);
+ return;
+ }
+
ctdb_req_control_set_recmode(&request, CTDB_RECOVERY_NORMAL);
subreq = ctdb_client_control_multi_send(state, state->ev,
state->client,