diff options
author | Dianna Hohensee <dianna.hohensee@mongodb.com> | 2022-01-19 17:49:28 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-10 23:41:06 +0000 |
commit | 07bb54adafde83bb27692e9d72ae932f3efa7b15 (patch) | |
tree | 0960ae144e28ae791a44bb8f3685b50023d44ce8 /src/mongo/db/storage/snapshot_helper.cpp | |
parent | 3942b80ecb74a08ad546d5837a0959e4db5f7bdf (diff) | |
download | mongo-07bb54adafde83bb27692e9d72ae932f3efa7b15.tar.gz |
SERVER-59958 implement multi-collection support for AutoGetCollectionForRead* collection helpers
Diffstat (limited to 'src/mongo/db/storage/snapshot_helper.cpp')
-rw-r--r-- | src/mongo/db/storage/snapshot_helper.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/storage/snapshot_helper.cpp b/src/mongo/db/storage/snapshot_helper.cpp index db0d1e3c207..1245ff9f2ad 100644 --- a/src/mongo/db/storage/snapshot_helper.cpp +++ b/src/mongo/db/storage/snapshot_helper.cpp @@ -187,8 +187,6 @@ ReadSourceChange shouldChangeReadSource(OperationContext* opCtx, const Namespace bool collectionChangesConflictWithRead(boost::optional<Timestamp> collectionMin, boost::optional<Timestamp> readTimestamp) { - // This is the timestamp of the most recent catalog changes to this collection. If this is - // greater than any point in time read timestamps, we should either wait or return an error. if (!collectionMin) { return false; } @@ -198,7 +196,10 @@ bool collectionChangesConflictWithRead(boost::optional<Timestamp> collectionMin, return false; } - // Return if there are no conflicting catalog changes with the readTimestamp. + // If the last change to the collection was before or at the read timestamp, then the storage + // snapshot will match the collection in-memory state. Return true only if there would be an + // inconsistency: a collection with a newer min timestamp would not match an older storage + // snapshot. return *collectionMin > readTimestamp; } } // namespace SnapshotHelper |