summaryrefslogtreecommitdiff
path: root/db/repl/consensus.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'db/repl/consensus.cpp')
-rw-r--r--db/repl/consensus.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/db/repl/consensus.cpp b/db/repl/consensus.cpp
index f764abe..dadb22e 100644
--- a/db/repl/consensus.cpp
+++ b/db/repl/consensus.cpp
@@ -154,6 +154,12 @@ namespace mongo {
log() << "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
+ 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
log() << hopeful->fullName() << " is trying to elect itself but " <<