diff --git a/src/Interpreters/Cache/EvictionCandidates.cpp b/src/Interpreters/Cache/EvictionCandidates.cpp index fb0b3809f80..1a93c51572e 100644 --- a/src/Interpreters/Cache/EvictionCandidates.cpp +++ b/src/Interpreters/Cache/EvictionCandidates.cpp @@ -70,11 +70,14 @@ void EvictionCandidates::finalize(FileCacheQueryLimit::QueryContext * query_cont { for (const auto & it : invalidated_queue_entries) { + /// Remove entry from per query priority queue. if (query_context) { const auto & entry = it->getEntry(); query_context->remove(entry->key, entry->offset, lock); } + + /// Remove entry from main priority queue. it->remove(lock); } diff --git a/src/Interpreters/Cache/SLRUFileCachePriority.cpp b/src/Interpreters/Cache/SLRUFileCachePriority.cpp index 543d6a03669..84133bc5c56 100644 --- a/src/Interpreters/Cache/SLRUFileCachePriority.cpp +++ b/src/Interpreters/Cache/SLRUFileCachePriority.cpp @@ -218,6 +218,7 @@ void SLRUFileCachePriority::increasePriority(SLRUIterator & iterator, const Cach } /// Make space for "downgrade" candidates. eviction_candidates.evict(); + eviction_candidates.finalize(nullptr, lock); } /// All checks passed, now we can move downgrade candidates to