summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_entry_point_common.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2018-02-14 13:33:44 -0500
committerTess Avitabile <tess.avitabile@mongodb.com>2018-02-14 17:35:25 -0500
commitc927a61213f5e1e80d7535b6cb1a16f23a6d0b98 (patch)
tree7c72e5cd3fe8f4f9f36d1fa1c5fc3d2f20ed866a /src/mongo/db/service_entry_point_common.cpp
parente5e8dde676b585f5620608e95e93b9da295890c5 (diff)
downloadmongo-c927a61213f5e1e80d7535b6cb1a16f23a6d0b98.tar.gz
SERVER-33004 Add two-phase locking for shared locks for snapshot reads
Diffstat (limited to 'src/mongo/db/service_entry_point_common.cpp')
-rw-r--r--src/mongo/db/service_entry_point_common.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index ae6652e9e63..fa04082b936 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -601,6 +601,10 @@ void execCommandDatabase(OperationContext* opCtx,
auto& readConcernArgs = repl::ReadConcernArgs::get(opCtx);
readConcernArgs = uassertStatusOK(_extractReadConcern(command, dbname, request.body));
+ if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kSnapshotReadConcern) {
+ opCtx->lockState()->setSharedLocksShouldTwoPhaseLock(true);
+ }
+
auto& oss = OperationShardingState::get(opCtx);
if (!opCtx->getClient()->isInDirectClient() &&