diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2023-03-27 20:18:31 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-03-27 20:52:28 +0000 |
commit | f7019897eae47dbb7197ffc2ab843c1427db39d5 (patch) | |
tree | 9e817a11700df17a4829e4d8c1cac98af1c90020 | |
parent | fa131949d2ca5b3d79aa73783b03f5ad6895aff4 (diff) | |
download | mongo-f7019897eae47dbb7197ffc2ab843c1427db39d5.tar.gz |
SERVER-75314 Fix instantiating collections at latest in standalone mode
-rw-r--r-- | src/mongo/db/catalog/collection_catalog.cpp | 9 |
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(); } |