From: Andrew Tridgell Date: Mon, 15 Oct 2007 04:17:49 +0000 (+1000) Subject: merge from ronnie X-Git-Tag: tevent-0.9.20~348^2~2381 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e855c07722f32126b504cfa723fa1b408d8ffb9;p=thirdparty%2Fsamba.git merge from ronnie (This used to be ctdb commit d18712caba11855010be52f90bac656683076676) --- 0e855c07722f32126b504cfa723fa1b408d8ffb9 diff --cc ctdb/server/ctdb_recoverd.c index bfc9c167a21,7b574cf3ab7..5ead441eb09 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@@ -1022,26 -1017,14 +1022,14 @@@ static bool ctdb_election_win(struct ct ctdb_election_data(rec, &myem); - /* try to use a unbanned node */ - if ((em->node_flags & NODE_FLAGS_BANNED) && - !(myem.node_flags & NODE_FLAGS_BANNED)) { - cmp = 1; - } - if (!(em->node_flags & NODE_FLAGS_BANNED) && - (myem.node_flags & NODE_FLAGS_BANNED)) { - cmp = -1; - } + /* we cant win if we are banned */ + if (rec->node_flags & NODE_FLAGS_BANNED) { - return 0; ++ return false; + } - /* try to use a healthy node */ - if (cmp == 0) { - if ((em->node_flags & NODE_FLAGS_UNHEALTHY) && - !(myem.node_flags & NODE_FLAGS_UNHEALTHY)) { - cmp = 1; - } - if (!(em->node_flags & NODE_FLAGS_UNHEALTHY) && - (myem.node_flags & NODE_FLAGS_UNHEALTHY)) { - cmp = -1; - } + /* we will automatically win if the other node is banned */ + if (em->node_flags & NODE_FLAGS_BANNED) { - return 1; ++ return true; } /* try to use the most connected node */ @@@ -1585,7 -1568,24 +1573,24 @@@ again goto again; } - if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) { + /* if recovery master is disconnected we must elect a new recmaster */ + if (nodemap->nodes[j].flags & NODE_FLAGS_DISCONNECTED) { + DEBUG(0, ("Recmaster node %u is disconnected. Force reelection\n", nodemap->nodes[j].pnn)); + force_election(rec, mem_ctx, pnn, nodemap); + goto again; + } + - /* grap the nodemap from the recovery master to check if it is banned*/ ++ /* grap the nodemap from the recovery master to check if it is banned */ + ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, + mem_ctx, &remote_nodemap); + if (ret != 0) { + DEBUG(0, (__location__ " Unable to get nodemap from recovery master %u\n", + nodemap->nodes[j].pnn)); + goto again; + } + + + if (remote_nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) { DEBUG(0, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].pnn)); force_election(rec, mem_ctx, pnn, nodemap); goto again;