summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2018-03-14 14:58:24 -0400
committerMatthew Russotto <matthew.russotto@10gen.com>2018-03-14 21:14:25 -0400
commit388d8c1245e61c4fa906254f711aec8ee7fe7486 (patch)
treea59270a61abb9f26529929abf33013ce889358e1 /src/mongo/db/db_raii.cpp
parent0109767b6962d18b60d89a723c0087cf27d370e3 (diff)
downloadmongo-388d8c1245e61c4fa906254f711aec8ee7fe7486.tar.gz
SERVER-33551 Track snapshot read transactions with MultiDocumentTransactionState in Session
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index 00b6a18352d..df4b851aa99 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -246,13 +246,10 @@ LockMode getLockModeForQuery(OperationContext* opCtx) {
invariant(opCtx);
// Use IX locks for autocommit:false multi-statement transactions; otherwise, use IS locks.
- if (opCtx->getWriteUnitOfWork()) {
- invariant(OperationContextSession::get(opCtx));
- if (!OperationContextSession::get(opCtx)->getAutocommit()) {
- return MODE_IX;
- }
+ auto session = OperationContextSession::get(opCtx);
+ if (session && session->inMultiDocumentTransaction()) {
+ return MODE_IX;
}
-
return MODE_IS;
}