summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/test_commands.cpp
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2017-03-02 13:54:24 -0500
committerCharlie Swanson <charlie.swanson@mongodb.com>2017-03-15 11:03:44 -0400
commitf05b9437fbdc53deecf55ed3c20e36af3d733953 (patch)
tree8b66acc133f83f27ef00f31600538f225ec2746a /src/mongo/db/commands/test_commands.cpp
parenta1f15dfd788a78da77bda6675132d4144691fce1 (diff)
downloadmongo-f05b9437fbdc53deecf55ed3c20e36af3d733953.tar.gz
SERVER-22541 Refactor RAII locking helpers.
Removes the class 'ScopedTransaction' and moves the responsibility of abandoning the snapshot onto the GlobalLock class. Also renames the AutoGetCollectionForRead class to AutoGetCollectionForReadCommand, and adds a new AutoGetCollectionForRead class. Unlike AutoGetCollectionForReadCommand, this new class will not update the namespace on the CurrentOp object, nor will it add an entry to Top.
Diffstat (limited to 'src/mongo/db/commands/test_commands.cpp')
-rw-r--r--src/mongo/db/commands/test_commands.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 34bc757d554..685e8e7a013 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -85,8 +85,7 @@ public:
log() << "test only command godinsert invoked coll:" << nss.coll();
BSONObj obj = cmdObj["obj"].embeddedObjectUserCheck();
- ScopedTransaction transaction(opCtx, MODE_IX);
- Lock::DBLock lk(opCtx->lockState(), dbname, MODE_X);
+ Lock::DBLock lk(opCtx, dbname, MODE_X);
OldClientContext ctx(opCtx, nss.ns());
Database* db = ctx.db();
@@ -141,14 +140,12 @@ public:
std::vector<Privilege>* out) {}
void _sleepInReadLock(mongo::OperationContext* opCtx, long long millis) {
- ScopedTransaction transaction(opCtx, MODE_S);
- Lock::GlobalRead lk(opCtx->lockState());
+ Lock::GlobalRead lk(opCtx);
sleepmillis(millis);
}
void _sleepInWriteLock(mongo::OperationContext* opCtx, long long millis) {
- ScopedTransaction transaction(opCtx, MODE_X);
- Lock::GlobalWrite lk(opCtx->lockState());
+ Lock::GlobalWrite lk(opCtx);
sleepmillis(millis);
}