diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-03-13 17:15:58 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-13 21:30:48 +0000 |
commit | df0272716ae3a6767e33adf98392dddea494e587 (patch) | |
tree | 6f15569421a97277b180f902319a549326f86ff9 /src/mongo/db/catalog | |
parent | 7ce09a820efeceb4f0a3a70140748aaf88309452 (diff) | |
download | mongo-df0272716ae3a6767e33adf98392dddea494e587.tar.gz |
SERVER-46640 The TTLMonitor should not remove the cached index information from the TTLCollectionCache when a collection is not yet visible
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r-- | src/mongo/db/catalog/collection_catalog.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/catalog/collection_catalog.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/collection_catalog.cpp b/src/mongo/db/catalog/collection_catalog.cpp index ec80653054a..bdb5018016f 100644 --- a/src/mongo/db/catalog/collection_catalog.cpp +++ b/src/mongo/db/catalog/collection_catalog.cpp @@ -268,6 +268,12 @@ void CollectionCatalog::makeCollectionVisible(CollectionUUID uuid) { coll->setCommitted(true); } +bool CollectionCatalog::isCollectionAwaitingVisibility(CollectionUUID uuid) const { + stdx::lock_guard<Latch> lock(_catalogLock); + auto coll = _lookupCollectionByUUID(lock, uuid); + return coll && !coll->isCommitted(); +} + Collection* CollectionCatalog::_lookupCollectionByUUID(WithLock, CollectionUUID uuid) const { auto foundIt = _catalog.find(uuid); return foundIt == _catalog.end() ? nullptr : foundIt->second.get(); diff --git a/src/mongo/db/catalog/collection_catalog.h b/src/mongo/db/catalog/collection_catalog.h index d9ddac71fb1..23d0bf88b25 100644 --- a/src/mongo/db/catalog/collection_catalog.h +++ b/src/mongo/db/catalog/collection_catalog.h @@ -146,6 +146,12 @@ public: void makeCollectionVisible(CollectionUUID uuid); /** + * Returns true if the collection has been registered in the CollectionCatalog but not yet made + * visible. + */ + bool isCollectionAwaitingVisibility(CollectionUUID uuid) const; + + /** * This function gets the Collection pointer that corresponds to the NamespaceString. * The required locks must be obtained prior to calling this function, or else the found * Collection pointer may no longer be valid when the call returns. |