Repository navigation
Reduce peak memory of the 03742_nested_loop_join_long direct-join load test - #111644
alexey-milovidov merged 1 commit into
Conversation
03742_nested_loop_join_long is a residual MEMORY_LIMIT_EXCEEDED (Code 241) source on Stateless tests (amd_asan_ubsan, distributed plan, parallel). The failure is a server-wide OvercommitTracker rejection, not a per-query limit: the aggregate RSS of the heavy tests co-scheduled on one memory-capped sanitizer server (ratio cut in ClickHouse#110574) overruns the cap, so the tracker stops a query mid-JoiningTransform. This test is one of the heaviest contributors: its INNER events JOIN attributes fans a small left table (events, 34/33 rows per key) against a large right table (attributes, 800K/300K rows per key) into a 37.1M-row result that the direct-join path materializes as a single ~1.2 GiB chunk. ClickHouse#110574 already cut this shard's concurrency to its practical floor, and the direct join does not split its output by max_block_size, so reducing this test's own peak is the remaining lever. Shrink only the left-table row count, numbers(100) -> numbers(12) (4 rows per key). This cuts the INNER fan-out to 4.4M rows and the peak to ~400 MiB (~3x lower), while keeping everything the load test checks: the direct join algorithm, multi-match fan-out, the full 1.4M-row attributes right side, the Nullable key with NULL rows, and all four join strictnesses. The large events2 x attributes2 case is unchanged. Regenerate the reference; keep the long tag.
Internal second-model review — adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings; bounded: 1 full pass + 1 fix round + 1 delta recheck). Reviewer coverage: read both changed files in full, traced direct-join planning and execution plus sibling tests, and independently verified the exact output and the focused peak-memory reduction. No material surface uncovered; no blockers, majors, or nits raised.
Severity: ❌ blocker / Session id: cron:clickhouse-author-slot-7:20260723-112200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-author-slot-7:20260723-112200 |
|
cc @nickitat — could you review this? Test-only change: it shrinks the left table of |
|
Workflow [PR], commit [21b9523] Summary: ✅ AI ReviewSummaryThis PR reduces the left-side cardinality in Final VerdictStatus: ✅ Approve |
…ted-plan-oom-residual Reduce peak memory of the 03742_nested_loop_join_long direct-join load test
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
03742_nested_loop_join_longis a residualMEMORY_LIMIT_EXCEEDED(Code 241) source onStateless tests (amd_asan_ubsan, distributed plan, parallel)(~40 failures / 30 days across ~34 PRs + master), reported by @ alexey-milovidov on #111492.The failure is a server-wide OvercommitTracker rejection, not a per-query limit: the aggregate RSS of the heavy tests co-scheduled on one memory-capped sanitizer server (
max_server_memory_usage_to_ram_ratiocut to keep the host safe, see #110574) overruns the cap, so the tracker stops a query mid-JoiningTransform. The stopped query only needs 0.6-5.5 GiB; the server is already at its cap (~44.8 GiB). This is aggregate pressure, not a leak: the same build'sdistributed plan, parallel, 2/2split variant (half the tests per server) has 0 failures, while the unsplit variant has 40.03742is one of the heaviest contributors. Its INNERevents JOIN attributesfans a small left table (events,number % 3 + 2overnumbers(100)= 34/33 rows per key) against a large right table (attributes, 800K/300K rows per key), producing a 37.1M-row result that the direct-join path materializes as a single chunk (peak ~1.2 GiB locally; the direct join does not split the output bymax_block_sizeormax_joined_block_size_rows). #110574 already cut this shard's concurrency to its practical floor.Fix: shrink only the left-table row count,
numbers(100)->numbers(12)(4 rows per key). This cuts the INNER fan-out to 4.4M rows and the measured peak to ~400 MiB (~3x lower), while keeping everything the load test checks: thedirectjoin algorithm, multi-match fan-out, the full 1.4M-rowattributesright side, theNullablekey with NULL rows, and all four join strictnesses (INNER/LEFT/SEMI/ANTI). The separate largeevents2 x attributes2case (1M x 1M, hash-collision keys) is left unchanged. The.referenceis regenerated (per-key counts scale down: INNER key 2 27.2M -> 3.2M, key 3 9.9M -> 1.2M). Taglongkept.Verified locally (debug, master): OLD data fails and NEW data passes under a 700 MiB per-query budget; whole test run 3x deterministic; every query stable across 50 randomized-settings runs.