1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

recoverd: Delay the initial election if node is started in stopped state

Since there is an early exit if a node is stopped or banned, we can wait till
the node becomes active to start initial election.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 593a17678fbd3109e118154b034d43b852659518)
This commit is contained in:
Amitay Isaacs 2013-06-27 15:44:27 +10:00
parent d2411e74f1
commit 32f9d7c0d4

View File

@ -3425,28 +3425,6 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
/* remember our own node flags */
rec->node_flags = nodemap->nodes[pnn].flags;
/* check which node is the recovery master */
ret = ctdb_ctrl_getrecmaster(ctdb, mem_ctx, CONTROL_TIMEOUT(), pnn, &rec->recmaster);
if (ret != 0) {
DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from node %u\n", pnn));
return;
}
/* if we are not the recmaster we can safely ignore any ip reallocate requests */
if (rec->recmaster != pnn) {
if (rec->ip_reallocate_ctx != NULL) {
talloc_free(rec->ip_reallocate_ctx);
rec->ip_reallocate_ctx = NULL;
rec->reallocate_callers = NULL;
}
}
if (rec->recmaster == (uint32_t)-1) {
DEBUG(DEBUG_NOTICE,(__location__ " Initial recovery master set - forcing election\n"));
force_election(rec, pnn, nodemap);
return;
}
/* if the local daemon is STOPPED or BANNED, we verify that the databases are
also frozen and thet the recmode is set to active.
*/
@ -3478,6 +3456,32 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
return;
}
/* check which node is the recovery master */
ret = ctdb_ctrl_getrecmaster(ctdb, mem_ctx, CONTROL_TIMEOUT(), pnn, &rec->recmaster);
if (ret != 0) {
DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from node %u\n", pnn));
return;
}
/* if we are not the recmaster we can safely ignore any ip reallocate requests */
if (rec->recmaster != pnn) {
if (rec->ip_reallocate_ctx != NULL) {
talloc_free(rec->ip_reallocate_ctx);
rec->ip_reallocate_ctx = NULL;
rec->reallocate_callers = NULL;
}
}
/* This is a special case. When recovery daemon is started, recmaster
* is set to -1. If a node is not started in stopped state, then
* start election to decide recovery master
*/
if (rec->recmaster == (uint32_t)-1) {
DEBUG(DEBUG_NOTICE,(__location__ " Initial recovery master set - forcing election\n"));
force_election(rec, pnn, nodemap);
return;
}
/* update the capabilities for all nodes */
ret = update_capabilities(ctdb, nodemap);
if (ret != 0) {