summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/repltests.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/dbtests/repltests.cpp
parentba3db7220399aedbb871aa8a18d325a877c30d53 (diff)
downloadmongo-73f9e8b8a8422becf8694fe3d82c0e647dc71189.tar.gz
SERVER-26965 Use RAII type for turning off replicated writes
Diffstat (limited to 'src/mongo/dbtests/repltests.cpp')
-rw-r--r--src/mongo/dbtests/repltests.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 59eedcd86b7..cb2032f8ccc 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -187,9 +187,8 @@ protected:
if (0) {
mongo::unittest::log() << "op: " << *i << endl;
}
- _opCtx.setReplicatedWrites(false);
+ repl::UnreplicatedWritesBlock uwb(&_opCtx);
a.applyOperation(&_opCtx, ctx.db(), *i);
- _opCtx.setReplicatedWrites(true);
}
}
}
@@ -240,9 +239,8 @@ protected:
OpDebug* const nullOpDebug = nullptr;
if (o.hasField("_id")) {
- _opCtx.setReplicatedWrites(false);
+ repl::UnreplicatedWritesBlock uwb(&_opCtx);
coll->insertDocument(&_opCtx, o, nullOpDebug, true);
- _opCtx.setReplicatedWrites(true);
wunit.commit();
return;
}
@@ -252,9 +250,8 @@ protected:
id.init();
b.appendOID("_id", &id);
b.appendElements(o);
- _opCtx.setReplicatedWrites(false);
+ repl::UnreplicatedWritesBlock uwb(&_opCtx);
coll->insertDocument(&_opCtx, b.obj(), nullOpDebug, true);
- _opCtx.setReplicatedWrites(true);
wunit.commit();
}
static BSONObj wid(const char* json) {