summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2023-03-27 20:18:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-03-27 20:52:28 +0000
commitf7019897eae47dbb7197ffc2ab843c1427db39d5 (patch)
tree9e817a11700df17a4829e4d8c1cac98af1c90020 /src/mongo/db/catalog
parentfa131949d2ca5b3d79aa73783b03f5ad6895aff4 (diff)
downloadmongo-f7019897eae47dbb7197ffc2ab843c1427db39d5.tar.gz
SERVER-75314 Fix instantiating collections at latest in standalone mode
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r--src/mongo/db/catalog/collection_catalog.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/catalog/collection_catalog.cpp b/src/mongo/db/catalog/collection_catalog.cpp
index 2a31e76ec09..faa32873155 100644
--- a/src/mongo/db/catalog/collection_catalog.cpp
+++ b/src/mongo/db/catalog/collection_catalog.cpp
@@ -1002,9 +1002,12 @@ const Collection* CollectionCatalog::_openCollectionAtLatestByNamespaceOrUUID(
latestCollection ? latestCollection : pendingCollection,
/*readTimestamp=*/boost::none,
durableCatalogEntry.get());
- invariant(compatibleCollection);
- openedCollections.store(
- compatibleCollection, compatibleCollection->ns(), compatibleCollection->uuid());
+
+ // This may nullptr if the collection was not instantiated successfully. This is the case when
+ // timestamps aren't used (e.g. standalone mode) even though the durable catalog entry was
+ // found. When timestamps aren't used, the drop pending reaper immediately drops idents which
+ // may be needed to instantiate this collection.
+ openedCollections.store(compatibleCollection, nss, uuid);
return compatibleCollection.get();
}