diff options
author | William Schultz <william.schultz@mongodb.com> | 2018-11-21 16:00:29 -0500 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2018-11-21 16:00:29 -0500 |
commit | 6c2879fca21a4a43c4e173115850b979b434cb88 (patch) | |
tree | a8233c4282dd65db397d594311e7b57a531b2129 /src/mongo/db/catalog_raii.cpp | |
parent | cce280f98a8badf8aef4ed960e82e61e61d3fe5e (diff) | |
download | mongo-6c2879fca21a4a43c4e173115850b979b434cb88.tar.gz |
SERVER-38218 AutoGetCollection doesn't need to call getPointInTimeReadTimestamp for non snapshot read concern levels
Diffstat (limited to 'src/mongo/db/catalog_raii.cpp')
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index 79e4e8e10d4..e058bf48034 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -104,18 +104,20 @@ AutoGetCollection::AutoGetCollection(OperationContext* opCtx, // 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(); - auto mySnapshot = opCtx->recoveryUnit()->getPointInTimeReadTimestamp(); - if (readConcernLevel == repl::ReadConcernLevel::kSnapshotReadConcern && mySnapshot && + if (readConcernLevel == repl::ReadConcernLevel::kSnapshotReadConcern && _resolvedNss != NamespaceString::kRsOplogNamespace) { - auto minSnapshot = _coll->getMinimumVisibleSnapshot(); - uassert( - ErrorCodes::SnapshotUnavailable, - str::stream() << "Unable to read from a snapshot due to pending collection catalog " - "changes; please retry the operation. Snapshot timestamp is " - << mySnapshot->toString() - << ". Collection minimum is " - << minSnapshot->toString(), - !minSnapshot || *mySnapshot >= *minSnapshot); + auto mySnapshot = opCtx->recoveryUnit()->getPointInTimeReadTimestamp(); + if (mySnapshot) { + auto minSnapshot = _coll->getMinimumVisibleSnapshot(); + uassert(ErrorCodes::SnapshotUnavailable, + str::stream() + << "Unable to read from a snapshot due to pending collection catalog " + "changes; please retry the operation. Snapshot timestamp is " + << mySnapshot->toString() + << ". Collection minimum is " + << minSnapshot->toString(), + !minSnapshot || *mySnapshot >= *minSnapshot); + } } // If the collection exists, there is no need to check for views. |