summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/db_raii.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index bd906e36f15..b0d94e170ec 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -497,9 +497,12 @@ AutoGetCollectionForReadBase<AutoGetCollectionType, EmplaceAutoCollFunc>::
// Once we have our locks, check whether or not we should override the ReadSource that was
// set before acquiring locks.
- const bool shouldReadAtLastApplied = SnapshotHelper::changeReadSourceIfNeeded(opCtx, nss);
- // Update readSource in case it was updated.
- readSource = opCtx->recoveryUnit()->getTimestampReadSource();
+ auto [newReadSource, shouldReadAtLastApplied] =
+ SnapshotHelper::shouldChangeReadSource(opCtx, nss);
+ if (newReadSource) {
+ opCtx->recoveryUnit()->setTimestampReadSource(*newReadSource);
+ readSource = *newReadSource;
+ }
const auto readTimestamp = opCtx->recoveryUnit()->getPointInTimeReadTimestamp(opCtx);
if (readTimestamp && afterClusterTime) {
@@ -699,7 +702,11 @@ 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) {
- SnapshotHelper::changeReadSourceIfNeeded(opCtx, coll->ns());
+ auto [newReadSource, _] =
+ SnapshotHelper::shouldChangeReadSource(opCtx, coll->ns());
+ if (newReadSource) {
+ opCtx->recoveryUnit()->setTimestampReadSource(*newReadSource);
+ }
}
return std::make_pair(coll, /* isView */ false);
@@ -936,18 +943,6 @@ const NamespaceString& AutoGetCollectionForReadCommandMaybeLockFree::getNss() co
}
}
-query_shape::CollectionType AutoGetCollectionForReadCommandMaybeLockFree::getCollectionType()
- const {
- if (auto&& view = getView()) {
- return view->timeseries() ? query_shape::CollectionType::kTimeseries
- : query_shape::CollectionType::kView;
- }
- auto&& collection = getCollection();
- return collection ? query_shape::CollectionType::kCollection
- : query_shape::CollectionType::kNonExistent;
-}
-
-
bool AutoGetCollectionForReadCommandMaybeLockFree::isAnySecondaryNamespaceAViewOrSharded() const {
return _autoGet ? _autoGet->isAnySecondaryNamespaceAViewOrSharded()
: _autoGetLockFree->isAnySecondaryNamespaceAViewOrSharded();