Repository navigation
Fix SLRU race bug in fs cache 26.1+ - #101991
Conversation
|
Workflow [PR], commit [5f6a8f7] Summary: ❌
AI ReviewSummaryThis PR fixes an ClickHouse Rules
Final Verdict
|
|
Is it possible to write a unit test? |
No, it depends on too many things to coincide at a certain period of time which is not possible to form in a unit test since the methods used are complex by itself and cannot be used in a unit test in a dismantled way. |
Reproduced in integration stress test, added in this PR. |
1b6cd75 to
4f3827e
Compare
4f3827e to
4b6a4ec
Compare
| ) | ||
| finally: | ||
| stop_event.set() | ||
| drop_thread.join(timeout=5) |
There was a problem hiding this comment.
drop_thread.join(timeout=5) can return while the daemon thread is still alive. In that case the background loop keeps issuing SYSTEM CLEAR FILESYSTEM CACHE after the test body exits, which can leak activity into subsequent tests and make failures non-deterministic.
Please make thread shutdown strict here (for example, join without timeout, or keep timeout but then assert not drop_thread.is_alive() and fail fast).
4b6a4ec to
8e75d32
Compare
- Increase value size from `randomString(100)` to `randomString(500)` so the dataset (~50 MB) is much larger than the 1 MB cache, ensuring every scan triggers eviction and continuous probationary ↔ protected queue transitions. - Replace the `SELECT count()` benchmark + concurrent `SYSTEM CLEAR FILESYSTEM CACHE` loop with a simpler `SELECT sum(key)` benchmark. The cache-drop loop was racy and could suppress the very errors we want to detect. - Change the error check from `system.errors` to `node.contains_in_log` because `chassert` failures in a debug or sanitizer build abort the server process, so `LOGICAL_ERROR` never reaches `system.errors` but always appears in the server log. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This reverts commit 87bc492.
LLVM Coverage Report
Changed lines: 92.96% (66/71) | lost baseline coverage: 3 line(s) · Uncovered code |
Backport #101991 to 26.2: Fix SLRU race bug in fs cache 26.1+
Backport #101991 to 26.3: Fix SLRU race bug in fs cache 26.1+
Backport #101991 to 26.1: Fix SLRU race bug in fs cache 26.1+
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix SLRU race bug in filesystem cache 26.1+, which can lead to space reservation logical error. In debug build it can also lead to failed assert:
'Previous state is Evicting, but expected state to be Active while setting Evicting flag for 2c1e3484ecdc6b78a8978fa5b17c5097:0:339 (state: Evicting)'.Documentation entry for user-facing changes
Version info
26.4.1.72226.3.6.4,26.2.10.7,26.1.10.8