diff options
author | James Wahlin <james@mongodb.com> | 2018-03-12 15:52:10 -0400 |
---|---|---|
committer | James Wahlin <james@mongodb.com> | 2018-03-14 12:04:30 -0400 |
commit | 8727cdfc81358fa829cb86153606b84efca4edfd (patch) | |
tree | de4e06f772684611663f0923db5761fda9468ae9 /src/mongo/db/db_raii.cpp | |
parent | ebbd763514514d3ed77c25477c61d71df0d91420 (diff) | |
download | mongo-8727cdfc81358fa829cb86153606b84efca4edfd.tar.gz |
SERVER-33722 readConcern snapshot should return an error for metadata changes
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r-- | src/mongo/db/db_raii.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp index f42857afb76..00b6a18352d 100644 --- a/src/mongo/db/db_raii.cpp +++ b/src/mongo/db/db_raii.cpp @@ -91,7 +91,7 @@ AutoGetCollectionForRead::AutoGetCollectionForRead(OperationContext* opCtx, if (!minSnapshot) { return; } - auto mySnapshot = opCtx->recoveryUnit()->getMajorityCommittedSnapshot(); + auto mySnapshot = opCtx->recoveryUnit()->getPointInTimeReadTimestamp(); if (!mySnapshot) { return; } @@ -99,6 +99,18 @@ AutoGetCollectionForRead::AutoGetCollectionForRead(OperationContext* opCtx, return; } + auto readConcernLevel = opCtx->recoveryUnit()->getReadConcernLevel(); + if (readConcernLevel == repl::ReadConcernLevel::kSnapshotReadConcern) { + uasserted(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()); + } + invariant(readConcernLevel == repl::ReadConcernLevel::kMajorityReadConcern); + // Yield locks in order to do the blocking call below _autoColl = boost::none; |