struct timeval first_recover_time;
struct ban_state **banned_nodes;
struct timeval priority_time;
+ bool need_takeover_run;
};
#define CONTROL_TIMEOUT() timeval_current_ofs(ctdb->tunable.recover_timeout, 0)
if enabled, tell nodes to takeover their public IPs
*/
if (ctdb->vnn) {
+ rec->need_takeover_run = false;
ret = ctdb_takeover_run(ctdb, nodemap);
if (ret != 0) {
DEBUG(0, (__location__ " Unable to setup public takeover addresses\n"));
TALLOC_CTX *tmp_ctx;
uint32_t changed_flags;
int i;
+ struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
if (data.dsize != sizeof(*c)) {
DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
during recovery
*/
if (changed_flags & NODE_FLAGS_DISABLED) {
- ret = ctdb_takeover_run(ctdb, nodemap);
- if (ret != 0) {
- DEBUG(0, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
- ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(),
- ctdb->pnn, CTDB_RECOVERY_ACTIVE);
- }
- /* send a message to all clients telling them that the
- cluster has been reconfigured */
- ctdb_send_message(ctdb, CTDB_BROADCAST_CONNECTED, CTDB_SRVID_RECONFIGURE, tdb_null);
+ rec->need_takeover_run = true;
}
}
struct ctdb_vnn_map *vnnmap=NULL;
struct ctdb_vnn_map *remote_vnnmap=NULL;
int i, j, ret;
- bool need_takeover_run;
struct ctdb_recoverd *rec;
rec = talloc_zero(ctdb, struct ctdb_recoverd);
ctdb_set_message_handler(ctdb, CTDB_SRVID_UNBAN_NODE, unban_handler, rec);
again:
- need_takeover_run = false;
-
if (mem_ctx) {
talloc_free(mem_ctx);
mem_ctx = NULL;
/* if we are not the recmaster then we do not need to check
if recovery is needed
*/
- if (pnn!=recmaster) {
+ if (pnn != recmaster) {
goto again;
}
matches in this code) */
if (nodemap->nodes[j].flags != remote_nodemap->nodes[j].flags) {
nodemap->nodes[j].flags = remote_nodemap->nodes[j].flags;
- need_takeover_run = true;
+ rec->need_takeover_run = true;
}
}
}
/* we might need to change who has what IP assigned */
- if (need_takeover_run && ctdb->vnn) {
+ if (rec->need_takeover_run) {
+ rec->need_takeover_run = false;
ret = ctdb_takeover_run(ctdb, nodemap);
if (ret != 0) {
DEBUG(0, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
- ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(),
- ctdb->pnn, CTDB_RECOVERY_ACTIVE);
+ do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
+ vnnmap, nodemap->nodes[j].pnn);
}
}