summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
commit294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch)
tree279b1e0bab53901a1647ac63c1c724f0f789a663 /src/mongo/db/db_raii.cpp
parent70be7c27a251621187a1de533462ae2bb1e3bd39 (diff)
parent1e917fd798aa25b7066d4b414b51184f13d5a092 (diff)
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10' with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index b0d94e170ec..581f038afc8 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -497,12 +497,9 @@ AutoGetCollectionForReadBase<AutoGetCollectionType, EmplaceAutoCollFunc>::
// Once we have our locks, check whether or not we should override the ReadSource that was
// set before acquiring locks.
- auto [newReadSource, shouldReadAtLastApplied] =
- SnapshotHelper::shouldChangeReadSource(opCtx, nss);
- if (newReadSource) {
- opCtx->recoveryUnit()->setTimestampReadSource(*newReadSource);
- readSource = *newReadSource;
- }
+ const bool shouldReadAtLastApplied = SnapshotHelper::changeReadSourceIfNeeded(opCtx, nss);
+ // Update readSource in case it was updated.
+ readSource = opCtx->recoveryUnit()->getTimestampReadSource();
const auto readTimestamp = opCtx->recoveryUnit()->getPointInTimeReadTimestamp(opCtx);
if (readTimestamp && afterClusterTime) {
@@ -702,11 +699,7 @@ void AutoGetCollectionForReadLockFree::EmplaceHelper::emplace(
// replication state may have changed, invalidating our current choice of
// ReadSource. Using the same preconditions, change our ReadSource if necessary.
if (coll) {
- auto [newReadSource, _] =
- SnapshotHelper::shouldChangeReadSource(opCtx, coll->ns());
- if (newReadSource) {
- opCtx->recoveryUnit()->setTimestampReadSource(*newReadSource);
- }
+ SnapshotHelper::changeReadSourceIfNeeded(opCtx, coll->ns());
}
return std::make_pair(coll, /* isView */ false);