summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2017-03-09 12:34:17 -0500
committerMatthew Russotto <matthew.russotto@10gen.com>2017-03-13 09:02:03 -0400
commit73f9e8b8a8422becf8694fe3d82c0e647dc71189 (patch)
treeb938d6e3fd63fc00819b72231dfe952b8b212d79 /src/mongo/db/dbhelpers.cpp
parentba3db7220399aedbb871aa8a18d325a877c30d53 (diff)
downloadmongo-73f9e8b8a8422becf8694fe3d82c0e647dc71189.tar.gz
SERVER-26965 Use RAII type for turning off replicated writes
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r--src/mongo/db/dbhelpers.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 83f4c15e52d..265687697ff 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -495,9 +495,7 @@ long long Helpers::removeRange(OperationContext* opCtx,
void Helpers::emptyCollection(OperationContext* opCtx, const char* ns) {
OldClientContext context(opCtx, ns);
- bool shouldReplicateWrites = opCtx->writesAreReplicated();
- opCtx->setReplicatedWrites(false);
- ON_BLOCK_EXIT(&OperationContext::setReplicatedWrites, opCtx, shouldReplicateWrites);
+ repl::UnreplicatedWritesBlock uwb(opCtx);
Collection* collection = context.db() ? context.db()->getCollection(ns) : nullptr;
deleteObjects(opCtx, collection, ns, BSONObj(), PlanExecutor::YIELD_MANUAL, false);
}