diff options
Diffstat (limited to 'db/repl/manager.cpp')
-rw-r--r-- | db/repl/manager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/db/repl/manager.cpp b/db/repl/manager.cpp index c91adc3..fb9b6cb 100644 --- a/db/repl/manager.cpp +++ b/db/repl/manager.cpp @@ -98,8 +98,14 @@ namespace mongo { const Member *primary = rs->box.getPrimary(); if (primary && highestPriority && - highestPriority->config().priority > primary->config().priority) { - log() << "stepping down " << primary->fullName() << endl; + highestPriority->config().priority > primary->config().priority && + // if we're stepping down to allow another member to become primary, we + // better have another member (otherOp), and it should be up-to-date + otherOp != 0 && highestPriority->hbinfo().opTime.getSecs() >= otherOp - 10) { + log() << "stepping down " << primary->fullName() << " (priority " << + primary->config().priority << "), " << highestPriority->fullName() << + " is priority " << highestPriority->config().priority << " and " << + (otherOp - highestPriority->hbinfo().opTime.getSecs()) << " seconds behind" << endl; if (primary->h().isSelf()) { // replSetStepDown tries to acquire the same lock |