The LookupCollectionForYieldRestore functor, defined in collection_catalog.cpp, is responsible for looking up the collection in the catalog in order to restore the internal state of the CollectionPtr.
The functor returns a nullptr in the case of drops but still returns a non-null pointer if there was a rename while yielding. For renames, the resulting CollectionPtr state might be inconsistent with the resource IDs in the restored lock state. Additionally, since changes to the catalog results in new COW-induced versions of the catalog, there is a risk of a stale catalog.
- related to
SERVER-65547 unused CollectionMock constructor overload ignores indexCatalog parameter