mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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
This commit is contained in:
parent
30460fc45e
commit
5aab31a39a
@ -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,6 +1628,49 @@ static void recovery_start_recovery_done(struct tevent_req *subreq)
|
||||
|
||||
LOG("start_recovery event finished\n");
|
||||
|
||||
ctdb_req_control_setvnnmap(&request, state->vnnmap);
|
||||
subreq = ctdb_client_control_multi_send(state, state->ev,
|
||||
state->client,
|
||||
state->pnn_list, state->count,
|
||||
TIMEOUT(), &request);
|
||||
if (tevent_req_nomem(subreq, req)) {
|
||||
return;
|
||||
}
|
||||
tevent_req_set_callback(subreq, recovery_vnnmap_update_done, req);
|
||||
}
|
||||
|
||||
static void recovery_vnnmap_update_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);
|
||||
int *err_list;
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
status = ctdb_client_control_multi_recv(subreq, &ret, NULL, &err_list,
|
||||
NULL);
|
||||
TALLOC_FREE(subreq);
|
||||
if (! status) {
|
||||
int ret2;
|
||||
uint32_t pnn;
|
||||
|
||||
ret2 = ctdb_client_control_multi_error(state->pnn_list,
|
||||
state->count,
|
||||
err_list, &pnn);
|
||||
if (ret2 != 0) {
|
||||
LOG("failed to update VNNMAP on node %u, ret=%d\n",
|
||||
pnn, ret2);
|
||||
} else {
|
||||
LOG("failed to update VNNMAP, ret=%d\n", ret);
|
||||
}
|
||||
tevent_req_error(req, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG("updated VNNMAP\n");
|
||||
|
||||
subreq = db_recovery_send(state, state->ev, state->client,
|
||||
state->dbmap, state->tun_list,
|
||||
state->pnn_list, state->count,
|
||||
@ -1657,50 +1701,6 @@ static void recovery_db_recovery_done(struct tevent_req *subreq)
|
||||
return;
|
||||
}
|
||||
|
||||
ctdb_req_control_setvnnmap(&request, state->vnnmap);
|
||||
subreq = ctdb_client_control_multi_send(state, state->ev,
|
||||
state->client,
|
||||
state->pnn_list, state->count,
|
||||
TIMEOUT(), &request);
|
||||
if (tevent_req_nomem(subreq, req)) {
|
||||
return;
|
||||
}
|
||||
tevent_req_set_callback(subreq, recovery_vnnmap_update_done, req);
|
||||
}
|
||||
|
||||
static void recovery_vnnmap_update_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;
|
||||
int *err_list;
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
status = ctdb_client_control_multi_recv(subreq, &ret, NULL, &err_list,
|
||||
NULL);
|
||||
TALLOC_FREE(subreq);
|
||||
if (! status) {
|
||||
int ret2;
|
||||
uint32_t pnn;
|
||||
|
||||
ret2 = ctdb_client_control_multi_error(state->pnn_list,
|
||||
state->count,
|
||||
err_list, &pnn);
|
||||
if (ret2 != 0) {
|
||||
LOG("failed to update VNNMAP on node %u, ret=%d\n",
|
||||
pnn, ret2);
|
||||
} else {
|
||||
LOG("failed to update VNNMAP, ret=%d\n", ret);
|
||||
}
|
||||
tevent_req_error(req, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG("updated VNNMAP\n");
|
||||
|
||||
ctdb_req_control_set_recmode(&request, CTDB_RECOVERY_NORMAL);
|
||||
subreq = ctdb_client_control_multi_send(state, state->ev,
|
||||
state->client,
|
||||
|
Loading…
Reference in New Issue
Block a user