summaryrefslogtreecommitdiff
path: root/src/mongo/db/range_deleter.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-06-17 17:45:53 -0400
committerRandolph Tan <randolph@10gen.com>2014-07-15 13:33:25 -0400
commitfa1233fbe4a48ef0675820f381987f1df4f42f75 (patch)
tree2f16f64be178a8aa417414dabb5e23f72c13e276 /src/mongo/db/range_deleter.cpp
parenta78c439ba94e08ab6079e5575f1959c39c9beb87 (diff)
downloadmongo-fa1233fbe4a48ef0675820f381987f1df4f42f75.tar.gz
SERVER-14041 enhance secondaryThrottle parameter
Diffstat (limited to 'src/mongo/db/range_deleter.cpp')
-rw-r--r--src/mongo/db/range_deleter.cpp27
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) {
}