diff options
author | Matthew Russotto <matthew.russotto@10gen.com> | 2018-03-14 14:58:24 -0400 |
---|---|---|
committer | Matthew Russotto <matthew.russotto@10gen.com> | 2018-03-14 21:14:25 -0400 |
commit | 388d8c1245e61c4fa906254f711aec8ee7fe7486 (patch) | |
tree | a59270a61abb9f26529929abf33013ce889358e1 /src/mongo/db/db_raii.cpp | |
parent | 0109767b6962d18b60d89a723c0087cf27d370e3 (diff) | |
download | mongo-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.cpp | 9 |
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; } |