summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Larkin-York <dan.larkin-york@mongodb.com>2022-08-24 13:49:24 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-25 20:14:14 +0000
commite727f8d673342f6f983408538b007b5c42b1fbf5 (patch)
treee630a2144b89492d80104dd47ae8183df8246688
parentc972dc293076b32b68fe452530fb2f3addb509b4 (diff)
downloadmongo-e727f8d673342f6f983408538b007b5c42b1fbf5.tar.gz
SERVER-69052 Ensure bucket collection is valid when checking for extended range
(cherry picked from commit 97989ceff09af0a2ed6a8c38fad42337d10fe1ec) (cherry picked from commit f374f58e555a189e2a945fe5812a434cb3889ee3)
-rw-r--r--src/mongo/db/op_observer/op_observer_impl.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/db/op_observer/op_observer_impl.cpp b/src/mongo/db/op_observer/op_observer_impl.cpp
index 625f732bc53..721189c13d2 100644
--- a/src/mongo/db/op_observer/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer/op_observer_impl.cpp
@@ -701,8 +701,10 @@ void OpObserverImpl::onInserts(OperationContext* opCtx,
// DOES need to be -- that will cause correctness issues). Additionally, if the user tried
// to insert measurements with dates outside the standard range, chances are they will do so
// again, and we will have only set the flag a little early.
+ invariant(opCtx->lockState()->isCollectionLockedForMode(nss, MODE_IX));
auto bucketsColl =
CollectionCatalog::get(opCtx)->lookupCollectionByNamespaceForRead(opCtx, nss);
+ tassert(6905201, "Could not find collection for write", bucketsColl);
auto timeSeriesOptions = bucketsColl->getTimeseriesOptions();
if (timeSeriesOptions.has_value()) {
if (auto currentSetting = bucketsColl->getRequiresTimeseriesExtendedRangeSupport();