The branch, master has been updated via b75ac1185481060ab71bd743e1e48d333d716eba (commit) via 1e007c833098b03dd81797c081da1ae1b10c971c (commit) from 99f239f8b96c8c0a06ac8ca8b8083be96265865a (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit b75ac1185481060ab71bd743e1e48d333d716eba Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Thu Jul 9 14:44:03 2009 +1000 stopped nodes can not win a recmaster election stopped nodes must yield the recmaster role commit 1e007c833098b03dd81797c081da1ae1b10c971c Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Thu Jul 9 14:34:12 2009 +1000 change the infolevel when logging stop/continue commands ----------------------------------------------------------------------- Summary of changes: server/ctdb_recover.c | 4 ++-- server/ctdb_recoverd.c | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c index 97602b9..b9a507b 100644 --- a/server/ctdb_recover.c +++ b/server/ctdb_recover.c @@ -1158,7 +1158,7 @@ int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb, uint32_t opcode, T int32_t ctdb_control_stop_node(struct ctdb_context *ctdb) { - DEBUG(DEBUG_ERR,(__location__ " Stopping node\n")); + DEBUG(DEBUG_INFO,(__location__ " Stopping node\n")); ctdb->nodes[ctdb->pnn]->flags |= NODE_FLAGS_STOPPED; return 0; @@ -1166,7 +1166,7 @@ int32_t ctdb_control_stop_node(struct ctdb_context *ctdb) int32_t ctdb_control_continue_node(struct ctdb_context *ctdb) { - DEBUG(DEBUG_ERR,(__location__ " Continue node\n")); + DEBUG(DEBUG_INFO,(__location__ " Continue node\n")); ctdb->nodes[ctdb->pnn]->flags &= ~NODE_FLAGS_STOPPED; return 0; diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c index 8f6106f..d601ca6 100644 --- a/server/ctdb_recoverd.c +++ b/server/ctdb_recoverd.c @@ -1660,11 +1660,21 @@ static bool ctdb_election_win(struct ctdb_recoverd *rec, struct election_message return false; } + /* we cant win if we are stopped */ + if (rec->node_flags & NODE_FLAGS_STOPPED) { + return false; + } + /* we will automatically win if the other node is banned */ if (em->node_flags & NODE_FLAGS_BANNED) { return true; } + /* we will automatically win if the other node is banned */ + if (em->node_flags & NODE_FLAGS_STOPPED) { + return true; + } + /* try to use the most connected node */ if (cmp == 0) { cmp = (int)myem.num_connected - (int)em->num_connected; @@ -2831,7 +2841,14 @@ again: goto again; } } - + /* If the local node is stopped, verify we are not the recmaster + and yield this role if so + */ + if ((nodemap->nodes[pnn].flags & NODE_FLAGS_STOPPED) && (rec->recmaster == pnn)) { + DEBUG(DEBUG_ERR,("Local node is STOPPED. Yielding recmaster role\n")); + force_election(rec, pnn, nodemap); + goto again; + } /* check that we (recovery daemon) and the local ctdb daemon agrees on whether we are banned or not -- CTDB repository