summaryrefslogtreecommitdiff
path: root/src/mongo/db/op_observer
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-24 14:20:24 +0000
commit97989ceff09af0a2ed6a8c38fad42337d10fe1ec (patch)
tree4768c2679654f1df92fbc66c7b496772f01255e1 /src/mongo/db/op_observer
parenta2b63a5e8d9a1ddfdac4d39f4afe6c7b3d077463 (diff)
downloadmongo-97989ceff09af0a2ed6a8c38fad42337d10fe1ec.tar.gz
SERVER-69052 Ensure bucket collection is valid when checking for extended range
Diffstat (limited to 'src/mongo/db/op_observer')
-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 27d718b8e1c..8cc856eb44a 100644
--- a/src/mongo/db/op_observer/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer/op_observer_impl.cpp
@@ -702,8 +702,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);
+ uassert(ErrorCodes::NamespaceNotFound, "Could not find collection for write", bucketsColl);
auto timeSeriesOptions = bucketsColl->getTimeseriesOptions();
if (timeSeriesOptions.has_value()) {
if (auto currentSetting = bucketsColl->getRequiresTimeseriesExtendedRangeSupport();