diff options
author | Randolph Tan <randolph@10gen.com> | 2014-07-15 16:48:59 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-07-16 13:41:37 -0400 |
commit | 2fd2eebb2656ae65bd6eb63b39f8faeb84e0db4e (patch) | |
tree | e74a56e3d3423d15565d739721f343fafa753798 /src/mongo/db/range_deleter.cpp | |
parent | d134ba27aa7f2c4eb8fc4b1331c8331f5914bfc6 (diff) | |
download | mongo-2fd2eebb2656ae65bd6eb63b39f8faeb84e0db4e.tar.gz |
SERVER-14041 enhance secondaryThrottle parameter
This reverts commit 37f2a1e3b724dbd9e1f8eafd4ac87c5bf613c048 (undo revert).
This reverts commit d60fd22dec1c0bd104622eab463cdbba18bf11a9 (undo revert).
Fix Windows compile failure.
Add more defensive checks.
Diffstat (limited to 'src/mongo/db/range_deleter.cpp')
-rw-r--r-- | src/mongo/db/range_deleter.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/mongo/db/range_deleter.cpp b/src/mongo/db/range_deleter.cpp index d096cab1219..e75ce96f0bd 100644 --- a/src/mongo/db/range_deleter.cpp +++ b/src/mongo/db/range_deleter.cpp @@ -189,7 +189,7 @@ namespace mongo { const BSONObj& min, const BSONObj& max, const BSONObj& shardKeyPattern, - bool secondaryThrottle, + const WriteConcernOptions& writeConcern, Notification* notifyDone, std::string* errMsg) { string dummy; @@ -199,7 +199,7 @@ namespace mongo { min.getOwned(), max.getOwned(), shardKeyPattern.getOwned(), - secondaryThrottle)); + writeConcern)); toDelete->notifyDone = notifyDone; { @@ -243,10 +243,13 @@ namespace mongo { } namespace { - bool _waitForReplication(OperationContext* txn, std::string* errMsg) { - WriteConcernOptions writeConcern; - writeConcern.wMode = "majority"; - writeConcern.wTimeout = 60 * 60 * 1000; + const int kWTimeoutMillis = 60 * 60 * 1000; + + bool _waitForMajority(OperationContext* txn, std::string* errMsg) { + const WriteConcernOptions writeConcern("majority", + WriteConcernOptions::NONE, + kWTimeoutMillis); + repl::ReplicationCoordinator::StatusAndDuration replStatus = repl::getGlobalReplicationCoordinator()->awaitReplicationOfLastOp(txn, writeConcern); @@ -279,7 +282,7 @@ namespace { const BSONObj& min, const BSONObj& max, const BSONObj& shardKeyPattern, - bool secondaryThrottle, + const WriteConcernOptions& writeConcern, string* errMsg) { if (stopRequested()) { *errMsg = "deleter is already stopped."; @@ -314,7 +317,7 @@ namespace { << " cursors in " << ns << " to finish" << endl; } - RangeDeleteEntry taskDetails(ns, min, max, shardKeyPattern, secondaryThrottle); + RangeDeleteEntry taskDetails(ns, min, max, shardKeyPattern, writeConcern); taskDetails.stats.queueStartTS = jsTime(); Date_t timeSinceLastLog; @@ -373,7 +376,7 @@ namespace { if (result) { taskDetails.stats.waitForReplStartTS = jsTime(); - result = _waitForReplication(txn, errMsg); + result = _waitForMajority(txn, errMsg); taskDetails.stats.waitForReplEndTS = jsTime(); } @@ -555,7 +558,7 @@ namespace { if (delResult) { nextTask->stats.waitForReplStartTS = jsTime(); - if (!_waitForReplication(txn.get(), &errMsg)) { + if (!_waitForMajority(txn.get(), &errMsg)) { warning() << "Error encountered while waiting for replication: " << errMsg; } @@ -662,12 +665,12 @@ namespace { const BSONObj& min, const BSONObj& max, const BSONObj& shardKey, - bool secondaryThrottle): + const WriteConcernOptions& writeConcern): ns(ns), min(min), max(max), shardKeyPattern(shardKey), - secondaryThrottle(secondaryThrottle), + writeConcern(writeConcern), notifyDone(NULL) { } |