diff options
author | Spencer T Brody <spencer@mongodb.com> | 2014-12-01 19:14:28 -0500 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2014-12-02 19:06:05 -0500 |
commit | 6c93bae163d0cbd4acf8e127c902844353b72c6b (patch) | |
tree | 4818439b989dafcb81ea1dfd0d5af37748724177 /src/mongo/db/dbcommands.cpp | |
parent | 6cab2a29c7dcb56ce132c200321bd1424f977f55 (diff) | |
download | mongo-6c93bae163d0cbd4acf8e127c902844353b72c6b.tar.gz |
SERVER-16389 Clean up behavior of shutdown command waiting for replication
Diffstat (limited to 'src/mongo/db/dbcommands.cpp')
-rw-r--r-- | src/mongo/db/dbcommands.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index 625ccc4a89f..08b3b687c56 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -101,9 +101,7 @@ namespace mongo { bool force = cmdObj.hasField("force") && cmdObj["force"].trueValue(); repl::ReplicationCoordinator* replCoord = repl::getGlobalReplicationCoordinator(); - if (!force && - replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet && - replCoord->getCurrentMemberState().primary()) { + if (replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet) { long long timeoutSecs = 0; if (cmdObj.hasField("timeoutSecs")) { timeoutSecs = cmdObj["timeoutSecs"].numberLong(); @@ -111,24 +109,12 @@ namespace mongo { Status status = repl::getGlobalReplicationCoordinator()->stepDown( txn, - false, + force, repl::ReplicationCoordinator::Milliseconds(timeoutSecs * 1000), repl::ReplicationCoordinator::Milliseconds(120 * 1000)); if (!status.isOK() && status.code() != ErrorCodes::NotMaster) { // ignore not master return appendCommandStatus(result, status); } - - // TODO(spencer): This block can be removed once stepDown() guarantees that a secondary - // is fully caught up instead of just within 10 seconds of the primary. - if (status.code() != ErrorCodes::NotMaster) { - WriteConcernOptions writeConcern; - writeConcern.wNumNodes = 2; - writeConcern.wTimeout = 60 * 1000; // 1 minute - // Note that return value is ignored - we shut down after 1 minute even if we're not - // done replicating. - repl::getGlobalReplicationCoordinator()->awaitReplicationOfLastOpApplied( - txn, writeConcern); - } } shutdownHelper(); |