diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
| commit | 4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch) | |
| tree | 1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/ttl_collection_cache.cpp | |
| parent | aa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff) | |
| parent | 8f0827553e09872941945a093b647a4211a9db7f (diff) | |
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0'
with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/ttl_collection_cache.cpp')
| -rw-r--r-- | src/mongo/db/ttl_collection_cache.cpp | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/src/mongo/db/ttl_collection_cache.cpp b/src/mongo/db/ttl_collection_cache.cpp index 86fcc682068..27d1335510c 100644 --- a/src/mongo/db/ttl_collection_cache.cpp +++ b/src/mongo/db/ttl_collection_cache.cpp @@ -63,30 +63,13 @@ void TTLCollectionCache::registerTTLInfo(UUID uuid, const Info& info) { } } -void TTLCollectionCache::_deregisterTTLInfo(UUID uuid, const Info& info) { +void TTLCollectionCache::deregisterTTLInfo(UUID uuid, const Info& info) { stdx::lock_guard<Latch> lock(_ttlInfosLock); auto infoIt = _ttlInfos.find(uuid); fassert(5400705, infoIt != _ttlInfos.end()); auto& [_, infoVec] = *infoIt; - auto iter = infoVec.begin(); - if (info.isClustered()) { - // For clustered collections, we cannot have more than one clustered info per UUID. - // All we have to do here is ensure that the 'info' to search for is also 'clustered'. - iter = std::find_if(infoVec.begin(), infoVec.end(), [](const auto& infoVecItem) { - return infoVecItem.isClustered(); - }); - } else { - // For TTL indexes, we search non-clustered TTL info items on the index name only. - auto indexName = info.getIndexName(); - iter = std::find_if(infoVec.begin(), infoVec.end(), [&indexName](const auto& infoVecItem) { - if (infoVecItem.isClustered()) { - return false; - } - return indexName == infoVecItem.getIndexName(); - }); - } - + auto iter = std::find(infoVec.begin(), infoVec.end(), info); fassert(40220, iter != infoVec.end()); infoVec.erase(iter); if (infoVec.empty()) { @@ -94,31 +77,6 @@ void TTLCollectionCache::_deregisterTTLInfo(UUID uuid, const Info& info) { } } -void TTLCollectionCache::deregisterTTLIndexByName(UUID uuid, const IndexName& indexName) { - _deregisterTTLInfo(std::move(uuid), TTLCollectionCache::Info{indexName, /*unusedSpec=*/{}}); -} - -void TTLCollectionCache::deregisterTTLClusteredIndex(UUID uuid) { - _deregisterTTLInfo(std::move(uuid), - TTLCollectionCache::Info{TTLCollectionCache::ClusteredId{}}); -} - -void TTLCollectionCache::unsetTTLIndexExpireAfterSecondsNaN(UUID uuid, const IndexName& indexName) { - stdx::lock_guard<Latch> lock(_ttlInfosLock); - auto infoIt = _ttlInfos.find(uuid); - if (infoIt == _ttlInfos.end()) { - return; - } - - auto&& infoVec = infoIt->second; - for (auto&& info : infoVec) { - if (!info.isClustered() && info.getIndexName() == indexName) { - info.unsetExpireAfterSecondsNaN(); - break; - } - } -} - TTLCollectionCache::InfoMap TTLCollectionCache::getTTLInfos() { stdx::lock_guard<Latch> lock(_ttlInfosLock); return _ttlInfos; |
