Skip to content

Commit db46866

Browse files
authored
Merge pull request ClickHouse#62551 from ClickHouse/fix-assertion-in-cache-slru
Fix assertion in stress test
2 parents d613a1d + 0ef2153 commit db46866

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Interpreters/Cache/SLRUFileCachePriority.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,13 @@ bool SLRUFileCachePriority::collectCandidatesForEvictionInProtected(
209209
{
210210
return false;
211211
}
212-
else
213-
chassert(downgrade_candidates->size() > 0);
212+
213+
/// We can have no downgrade candidates because cache size could
214+
/// reduce concurrently because of lock-free cache entries invalidation.
215+
if (downgrade_candidates->size() == 0)
216+
{
217+
return true;
218+
}
214219

215220
if (!probationary_queue.collectCandidatesForEviction(
216221
downgrade_stat.total_stat.releasable_size, downgrade_stat.total_stat.releasable_count,

0 commit comments

Comments
 (0)