diff options
author | Samy Lanka <samy.lanka@mongodb.com> | 2019-07-11 10:44:27 -0400 |
---|---|---|
committer | Samy Lanka <samy.lanka@mongodb.com> | 2019-08-08 11:35:32 -0400 |
commit | 77967c90b1a521108c052af235ce7de9742aa95e (patch) | |
tree | 22809f1433ab3b2b3f85359400a36a7d7f8050c4 /src/mongo/db/catalog_raii.cpp | |
parent | 321201823455e1c648b7c6bd4ae0a59d1b7115b8 (diff) | |
download | mongo-77967c90b1a521108c052af235ce7de9742aa95e.tar.gz |
SERVER-40466 Unify checks for being in a multi-document transaction
Diffstat (limited to 'src/mongo/db/catalog_raii.cpp')
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index e00052a7ddc..86599eff65c 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -107,11 +107,12 @@ AutoGetCollection::AutoGetCollection(OperationContext* opCtx, << nsOrUUID.toString()); if (_coll) { - // Unlike read concern majority, read concern snapshot cannot yield and wait when there are - // pending catalog changes. Instead, we must return an error in such situations. We ignore - // this restriction for the oplog, since it never has pending catalog changes. - auto readConcernLevel = repl::ReadConcernArgs::get(opCtx).getLevel(); - if (readConcernLevel == repl::ReadConcernLevel::kSnapshotReadConcern && + // If we are in a transaction and have a read timestamp, we cannot yield and wait when there + // are pending catalog changes. Instead, we must return an error in such situations. We + // ignore this restriction for the oplog, since it never has pending catalog changes. + if (opCtx->inMultiDocumentTransaction() && + opCtx->recoveryUnit()->getTimestampReadSource() != + RecoveryUnit::ReadSource::kNoTimestamp && _resolvedNss != NamespaceString::kRsOplogNamespace) { auto mySnapshot = opCtx->recoveryUnit()->getPointInTimeReadTimestamp(); if (mySnapshot) { |