summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2013-05-22 17:08:31 -0400
committerEric Milkie <milkie@10gen.com>2013-05-22 17:57:52 -0400
commit5ec76b730a94b6d8d072fab0a348e34debe72ea3 (patch)
tree7c7413ddd28c1aa0251373f71bc7db80f637ae2d
parentaa141a8f086230a25161299f685f9bd3c710936d (diff)
downloadmongo-5ec76b730a94b6d8d072fab0a348e34debe72ea3.tar.gz
SERVER-9730 under any circumstances, do not vote yea while a primary already exists
-rw-r--r--src/mongo/db/repl/consensus.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/db/repl/consensus.cpp b/src/mongo/db/repl/consensus.cpp
index 9d0f7b8c20e..3d38b120ad8 100644
--- a/src/mongo/db/repl/consensus.cpp
+++ b/src/mongo/db/repl/consensus.cpp
@@ -207,16 +207,14 @@ namespace mongo {
log() << "replSet electCmdReceived couldn't find member with id " << whoid << rsLog;
vote = -10000;
}
- else if( primary && primary == rs._self && rs.lastOpTimeWritten >= hopeful->hbinfo().opTime ) {
- // hbinfo is not updated, so we have to check the primary's last optime separately
+ else if( primary && primary == rs._self) {
log() << "I am already primary, " << hopeful->fullName()
<< " can try again once I've stepped down" << rsLog;
vote = -10000;
}
- else if( primary && primary->hbinfo().opTime >= hopeful->hbinfo().opTime ) {
- // other members might be aware of more up-to-date nodes
+ else if (primary) {
log() << hopeful->fullName() << " is trying to elect itself but " <<
- primary->fullName() << " is already primary and more up-to-date" << rsLog;
+ primary->fullName() << " is already primary" << rsLog;
vote = -10000;
}
else if( highestPriority && highestPriority->config().priority > hopeful->config().priority) {