Repository navigation
La Casa Del Dolor: do not generate a split SLRU cache with an empty queue - #133366
Conversation
…ueue La Casa Del Dolor (arm_asan_ubsan) on PR 133339 (sha 6e867ce) drew `fcache0` as SLRU with `use_split_cache=1`, `split_cache_ratio=0.99`, `slru_size_ratio=0.01` and `max_elements=1000`. `SplitFileCachePriority` gives the data part lround(1000 * 0.01) = 10 elements, its protected SLRU queue gets lround(10 * 0.01) = lround(0.1) = 0, and the `SLRUFileCachePriority` constructor rejects a queue without elements: "Cannot have zero max elements after ratio is applied" (BAD_ARGUMENTS), so the server exits with code 36 and the run ends before any fuzzing. 174d412 ("Cap `max_elements` of the Dolor filesystem caches", in ClickHouse#131994) lowered the generator floor of `max_elements` from 10000 to 1000. With 10000 the worst case, both ratios at an extreme, was 10000 * 0.01 * 0.01 = 1; with 1000 it rounds to 0. `normalize_cache_properties` already computes the smallest SLRU queue of each split part with the server's rounding, to fit the file segment into it. Factor that into `get_smallest_queue` and apply it to `max_elements` too: raise it until every SLRU queue gets at least one element, staying within `MAX_CACHE_ELEMENTS`. For the generated ratios (0.01 to 0.99) the worst case needs 4950, by the server's `std::lround` and by the harness rounding alike. The size logic is unchanged. Measured with an oracle that re-implements the server's check with libm `lround`: master's generator yields 1022 unstartable caches in 200000 seeded draws, this one 0; on 100000 seeds of both `filesystem_caches` entries and cache disks, 1042 configs differ and every difference is only `max_elements` of a cache master left unstartable. A master debug server exits with code 36 on the CI cache block (protected queue 0 elements) and starts with the normalized block (`max_elements` 4950; smallest queue 1 element). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261121-043000 |
|
cc @PedroTadim, could you review this? The harness can draw a split SLRU filesystem cache whose smallest queue rounds to 0 elements since the max_elements floor went to 1000, so the server refuses to start; normalize_cache_properties now raises max_elements to the smallest value that gives every SLRU queue at least one element. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261121-041700 |
|
Workflow [PR], commit [45d707c] Summary: ✅ AI ReviewSummaryThe PR prevents generated split SLRU caches from failing server startup by raising Final VerdictStatus: ✅ Approve |
da0a5e3
Related: #131994
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
La Casa Del Dolor can draw a filesystem cache that the server refuses at startup, so the run ends before any fuzzing. La Casa Del Dolor (arm_asan_ubsan) failed with
Instance 'node0' failed to start: the server exited with code 36, and the server log hasIncorrect max elements cache configuration. Max size: 10, size ratio: 0.01. Cannot have zero max elements after ratio is applied. (BAD_ARGUMENTS).The drawn cache was SLRU with
use_split_cache=1,split_cache_ratio=0.99,slru_size_ratio=0.01andmax_elements=1000. Its data part gets1000 * 0.01 = 10elements and the protected SLRU queue of that partlround(10 * 0.01) = 0, whichSLRUFileCachePriorityrejects. 174d412 (in #131994) lowered themax_elementsfloor from 10000 to 1000; with 10000 the worst case still rounded to 1.normalize_cache_propertiesalready shrinks the file segment to fit the smallest SLRU queue of each split part, using the server's rounding. This PR applies the same computation tomax_elements: when the smallest queue of an SLRU cache would get 0 elements,max_elementsis raised to the smallest value that gives every queue at least one element (at most 4950 for the generated ratios, withinMAX_CACHE_ELEMENTS). Other generated configs do not change.The alternative is to restore the floor to 10000 (or revert #131994). That also drops the 1000-9999 range for every cache, although only split SLRU caches with extreme ratios are invalid.
Validation (local): over 200000 seeded draws, master's generator produces 1022 caches the server would reject and this PR produces 0; on 100000 seeds of both generators, the only differences are
max_elementsof caches master leaves unstartable. A master debug server exits with code 36 on the CI cache block and starts with the normalized one (max_elements4950).🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/133366]
Version info
26.12.1.202-master(included in26.12and later)