1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

dont force an election just because the ban flag differs across the cluster.

a simple push to resync this flag is sufficient

(This used to be ctdb commit 8903b858ddd3a016d9cf765187839814443a67ca)
This commit is contained in:
Ronnie Sahlberg 2009-09-09 10:57:39 +10:00
parent 263d76f8c2
commit e578bed20d
2 changed files with 7 additions and 19 deletions

View File

@ -883,15 +883,6 @@ static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map *n
return MONITOR_FAILED; return MONITOR_FAILED;
} }
if (nodemap->nodes[j].flags != remote_nodemap->nodes[j].flags) { if (nodemap->nodes[j].flags != remote_nodemap->nodes[j].flags) {
int ban_changed = (nodemap->nodes[j].flags ^ remote_nodemap->nodes[j].flags) & NODE_FLAGS_BANNED;
if (ban_changed) {
DEBUG(DEBUG_NOTICE,("Remote node %u had different BANNED flags 0x%x, local had 0x%x - trigger a re-election\n",
nodemap->nodes[j].pnn,
remote_nodemap->nodes[j].flags,
nodemap->nodes[j].flags));
}
/* We should tell our daemon about this so it /* We should tell our daemon about this so it
updates its flags or else we will log the same updates its flags or else we will log the same
message again in the next iteration of recovery. message again in the next iteration of recovery.
@ -911,15 +902,6 @@ static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map *n
nodemap->nodes[j].pnn, remote_nodemap->nodes[j].flags, nodemap->nodes[j].pnn, remote_nodemap->nodes[j].flags,
nodemap->nodes[j].flags)); nodemap->nodes[j].flags));
nodemap->nodes[j].flags = remote_nodemap->nodes[j].flags; nodemap->nodes[j].flags = remote_nodemap->nodes[j].flags;
/* If the BANNED flag has changed for the node
this is a good reason to do a new election.
*/
if (ban_changed) {
talloc_free(mem_ctx);
return MONITOR_ELECTION_NEEDED;
}
} }
talloc_free(remote_nodemap); talloc_free(remote_nodemap);
} }

View File

@ -616,6 +616,8 @@ static void ctdb_event_script_handler(struct event_context *ev, struct fd_event
read(state->fd[0], &rt, sizeof(rt)); read(state->fd[0], &rt, sizeof(rt));
DEBUG(DEBUG_INFO,(__location__ " Eventscript %s finished with state %d\n", state->options, rt));
talloc_set_destructor(state, NULL); talloc_set_destructor(state, NULL);
talloc_free(state); talloc_free(state);
callback(ctdb, rt, private_data); callback(ctdb, rt, private_data);
@ -733,6 +735,8 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
state->private_data = private_data; state->private_data = private_data;
state->options = talloc_vasprintf(state, fmt, ap); state->options = talloc_vasprintf(state, fmt, ap);
CTDB_NO_MEMORY(ctdb, state->options); CTDB_NO_MEMORY(ctdb, state->options);
DEBUG(DEBUG_INFO,(__location__ " Starting eventscript %s\n", state->options));
ret = pipe(state->fd); ret = pipe(state->fd);
if (ret != 0) { if (ret != 0) {
@ -828,7 +832,9 @@ int ctdb_event_script(struct ctdb_context *ctdb, const char *fmt, ...)
struct callback_status status; struct callback_status status;
va_start(ap, fmt); va_start(ap, fmt);
ret = ctdb_event_script_callback_v(ctdb, timeval_zero(), tmp_ctx, event_script_callback, &status, fmt, ap); ret = ctdb_event_script_callback_v(ctdb,
timeval_current_ofs(ctdb->tunable.script_timeout, 0),
tmp_ctx, event_script_callback, &status, fmt, ap);
va_end(ap); va_end(ap);
if (ret != 0) { if (ret != 0) {