Repository navigation
Conversation
Q4 asserts RuntimeFilterBlocksProcessed = 0, which only the bloom filter can produce: with join_runtime_filter_exact_values_limit=1 and join_runtime_bloom_filter_bytes=100, ApproximateRuntimeFilter takes 2000 keys into 800 bits, so checkBloomFilterWorthiness sees an expected fill rate of 0.9994 against max_ratio_of_set_bits=0.7 and calls setFullyDisabled(). That short-circuits shouldSkip for every block, so findImpl and updateStats never run and nothing is counted as processed. join_runtime_filter_from_fixed_hash_table, whose default flipped to true in 26.6, lets HashJoin::publishSharedRuntimeFilters replace that fully-disabled bloom filter with a SharedFixedHashTableRuntimeFilter. That implementation has no full-disable path at all: setFullyDisabled has exactly two call sites in the tree and neither is reachable from it, and its finishInsertImpl is empty. The only remaining throttle is the pass-ratio heuristic in updateStats, and Q4's probe keys 5, 6, 7 and 100 all lie inside the build range 0..1999, so every probed row passes, the ratio stays at 1.0, and the filter probes one block then skips thirty, indefinitely. With max_block_size=10 that splits the 302 blocks into 12 processed and 290 skipped, so Processed = 0 is unreachable. Which implementation serves the join is not pinned by the test. The file sets join_algorithm = 'hash,parallel_hash', and PlannerJoins picks ConcurrentHashJoin when rhs_size_estimation is absent and plain HashJoin when it is present and below parallel_hash_join_threshold. ConcurrentHashJoin overrides neither hasPostBuildPhase nor runPostBuildPhase, so it never publishes the shared filter and Q4 passes there. rhs_size_estimation is overwritten from the process-global HashTablesStatistics cache, which is written when a join with the same cache key is destroyed and which collect_hash_table_stats_during_joins populates by default. Whether Q4 sees an estimate therefore depends on what ran earlier in the same server process, which is why the failure is invisible on master, appears in parallel jobs where one server runs the suite concurrently, and is fully deterministic once it starts: the in-job diagnostic rerun without randomized settings failed 104 out of 104. Pin join_runtime_filter_from_fixed_hash_table = 0 in Q4's SETTINGS clause, selecting the implementation whose dynamic-disable behaviour Q4 exists to test. The same pin for the same reason already exists at 04357_join_runtime_filter_size_from_hash_table_stats.sql:13. The pin is scoped to Q4 alone so the other six queries keep the default and the file still covers the shared fixed hash table filter end to end; 04241 remains its dedicated test. Verified locally: the forced arms give 12/290 with the setting on and 0/302 with it off, RuntimeFiltersCreated = 1 in both; the test fails before this change and passes after on one server and binary; 50 runs with randomized settings and 50 without all pass; and reverting the pin reddens the test 5 out of 5.
Internal second-model review (Gate B, cold) - 0 findings; own cold review - 3 nits, all resolvedTwo independent reviews ran against The cold review raised three nits, none blocking: 💡 The pin carries no comment, while the cited precedent 💡 The commit message's
💡 The carrier sweep was narrower than the invariant it tested. A sweep for any absolute The reviewer did not edit any source file; the tree is fingerprint-identical to the one handed over Session id: cron:clickhouse-review-slot-8:20260811-031900 |
Pre-PR validation gate (a-i)
Negative control: reverting the pin to Carrier check (measured from Randomized runs: 50 with randomization and 50 without, all passing, on a server whose |
|
cc @davenger, could you review this? Q4 asserts RuntimeFilterBlocksProcessed = 0, which only the bloom filter reaches via setFullyDisabled() on over-fill, but join_runtime_filter_from_fixed_hash_table lets publishSharedRuntimeFilters swap in a SharedFixedHashTableRuntimeFilter that has no full-disable path, so this pins the setting in Q4 alone (as 04357:13 already does) and leaves the other six queries on the default. |
| WHERE | ||
| c_nationkey = n.number::Int32 | ||
| SETTINGS join_runtime_filter_exact_values_limit=1, join_runtime_bloom_filter_bytes=100, max_block_size=10, max_threads=1, log_comment='Q4'; | ||
| SETTINGS join_runtime_filter_exact_values_limit=1, join_runtime_bloom_filter_bytes=100, join_runtime_filter_from_fixed_hash_table=0, max_block_size=10, max_threads=1, log_comment='Q4'; |
There was a problem hiding this comment.
@groeneai Please verify that join_runtime_filter_from_fixed_hash_table = 1 causes a test failure and join_runtime_filter_from_fixed_hash_table = 0 prevents it.
There was a problem hiding this comment.
Verified both ways on one server and one binary (Build ID 53ddd385f2deb04f2f4662f81d806984f44580f7, no rebuild between arms), running the real test, not just a ProfileEvents probe:
join_runtime_filter_from_fixed_hash_table in Q4 |
runs | result |
|---|---|---|
0 (as committed) |
3 | 3 OK |
1 |
5 | 5 FAIL |
0 again |
2 | 2 OK |
The = 1 failure is byte-identical to the CI one: RuntimeFiltersCreated: 1, RuntimeFilterBlocksProcessed: 12, RuntimeFilterBlocksSkipped: 290, so Q4's Processed = 0 conjunct is what fails. Created = 1 in both arms, so = 0 does not pass merely because no filter was built.
One caveat worth stating, because it means a single run of the toggle is not a sufficient demonstration: with = 1 on a freshly restarted server I get OK, FAIL, FAIL on three consecutive runs. The first run has no rhs_size_estimation yet, so PlannerJoins.cpp:1247 picks ConcurrentHashJoin, which inherits hasPostBuildPhase() = false and therefore never publishes the shared filter, leaving the bloom arm and its setFullyDisabled path intact. Once any earlier join populates the process-global HashTablesStatistics cache, the estimate is 2000, plain HashJoin is chosen, publishSharedRuntimeFilters replaces the fully disabled bloom filter with a SharedFixedHashTableRuntimeFilter, and that implementation has no full-disable path at all, so Processed = 0 becomes unreachable. That is why the failure is invisible on master, shows up in parallel jobs where one server runs many tests, and was fully deterministic once it started in CI (the in-job rerun without randomized settings failed 104 of 104).
There was a problem hiding this comment.
@groeneai move SET join_runtime_filter_from_fixed_hash_table = 0; to the settings sections above, this test is not meant to test the runtime filter from fixed hash table.
There was a problem hiding this comment.
Both done, and you were right on both counts.
Moved the pin to the settings section in 1549b82. I had scoped it to Q4 to keep the
other queries exercising the filter built from the fixed hash table, but that rationale does
not survive measurement: no query in this file except Q4 ever reaches that arm. Using the
publication trace in HashJoin::publishSharedRuntimeFilters as the observable, with no pin
anywhere I get exactly 1 publication per run (3 runs, 3 publications), and mapping those
query ids through system.query_log gives log_comment = Q4 for all 3. Q1/Q2/Q3/Q5/Q6/Q7
never publish. Their counters are identical with the setting pinned for the whole file and
with it absent: Q1 6/98, Q2 9/195, Q3 11/293, Q5 8/197, Q6 5/100, Q7 104/0,
RuntimeFiltersCreated = 1 throughout. So the wider scope costs no coverage, and 04241 stays
the dedicated test for that arm. 40 of 40 runs pass with the new form (20 randomized, 20 not);
removing the pin reddens it 5 of 5.
Your onset call is confirmed too. I built the pre-#111972 arm locally by dropping just the two
SpillingHashJoin post-build overrides, and A/B'd on one host with one test file and one server
configuration: without them the unpinned test passes 8 of 8 runs in a single process; with them
it passes the first run and then fails 7 of 7 with RuntimeFilterBlocksProcessed = 12,
byte-identical to CI. max_bytes_ratio_before_external_join defaults to 0.5, so
SpillingHashJoin wraps the join by default and used to inherit hasPostBuildPhase() = false,
which is what kept publishSharedRuntimeFilters from displacing the fully disabled bloom filter.
CIDB agrees on timing: 5 +Q4 0 failures across 5 different PRs all within 8 hours of your PR
merging, and none in the preceding 45 days.
The first-run-passes detail is why the flake looked random: the arm is chosen from the
process-global HashTablesStatistics cache, so a cold process takes ConcurrentHashJoin (no
post-build phase) and every later run in the same process takes plain HashJoin.
|
Workflow [PR], commit [1549b82] Summary: ✅ AI ReviewSummaryThis PR moves Final Verdict
|
| WHERE | ||
| c_nationkey = n.number::Int32 | ||
| SETTINGS join_runtime_filter_exact_values_limit=1, join_runtime_bloom_filter_bytes=100, max_block_size=10, max_threads=1, log_comment='Q4'; | ||
| SETTINGS join_runtime_filter_exact_values_limit=1, join_runtime_bloom_filter_bytes=100, join_runtime_filter_from_fixed_hash_table=0, max_block_size=10, max_threads=1, log_comment='Q4'; |
There was a problem hiding this comment.
@groeneai move SET join_runtime_filter_from_fixed_hash_table = 0; to the settings sections above, this test is not meant to test the runtime filter from fixed hash table.
Requested in review: 03753 is not the test of the runtime filter built from the fixed hash table, so the setting belongs in the file's settings section rather than only in Q4. Measured that the wider scope costs no coverage. With the setting pinned to 0 for the whole file and with it absent, Q1/Q2/Q3/Q5/Q6/Q7 produce identical RuntimeFilter counters (Q1 6/98, Q2 9/195, Q3 11/293, Q5 8/197, Q6 5/100, Q7 104/0, RuntimeFiltersCreated=1 throughout); only Q4 differs, 0/302 with the pin against 12/290 without it. 04241 remains the dedicated test of the shared fixed hash table filter. The onset is ClickHouse#111972, also identified in review. Verified by A/B on one host with one test file and one server configuration: with the two SpillingHashJoin post-build overrides removed, the unpinned test passes 8 of 8 runs in one process; with them present it passes the first run and then fails 7 of 7 with RuntimeFilterBlocksProcessed=12, byte-identical to CI. max_bytes_ratio_before_external_join defaults to 0.5, so SpillingHashJoin wraps the join by default and previously inherited hasPostBuildPhase() = false, which kept publishSharedRuntimeFilters from displacing the fully disabled bloom filter. 40 of 40 runs pass with the new form (20 randomized, 20 not). Removing the pin reddens the test 5 of 5.
CI finish ledger - 1549b82Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task CI is fully finished on this head: 175 checks, 0 incomplete, 39 real jobs OK, 135 skipped
Notes on two rows that are deliberately not ledger lines:
Session id: cron:our-pr-ci-monitor:20260811-180000 |
45ccfdf
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
03753_join_runtime_filter_dynamically_disablefails on the Q4 line only, printingQ4 0 ...instead of
Q4 1 Ok(sighting).
Root cause. Q4 asserts
RuntimeFilterBlocksProcessed = 0, which only the bloom filter reaches,via
setFullyDisabled()on over-fill. Withjoin_runtime_filter_from_fixed_hash_tableon,HashJoin::publishSharedRuntimeFiltersreplaces that fully disabled bloom filter with aSharedFixedHashTableRuntimeFilter, which has no full-disable path. Q4's probe keys all lie insidethe build range, so every row passes and only the pass-ratio heuristic throttles: the failing run
recorded
Processed = 12 / Skipped = 290.Processed = 0is unreachable there.Onset is #111972, as @ m-selmi identified in review.
max_bytes_ratio_before_external_joindefaults to 0.5, soSpillingHashJoinwraps the join bydefault and used to inherit
hasPostBuildPhase() = false, which kept the shared filter unpublished.A/B on one host, one test file, one server configuration: with those two overrides removed the
unpinned test passes 8 of 8 runs in one process; with them it passes the first run then fails 7 of 7
at
Processed = 12, byte-identical to CI. CIDB shows 5 such failures across 5 PRs within 8 hours ofthat merge, none in the preceding 45 days. The first run passes because the arm is
chosen from the process-global hash-table statistics cache, which is also why this is invisible on
master and shows up only in
paralleljobs.The change pins
join_runtime_filter_from_fixed_hash_table = 0for the file, selecting theimplementation whose disabling behaviour Q4 exists to test. It costs no coverage: only Q4 ever
reaches the shared-filter arm (3 runs, 3 publications, all
log_comment = Q4), and the other sixqueries give identical counters pinned and unpinned.
04241remains that arm's dedicated test.Validation. 40 of 40 runs pass (20 randomized, 20 not); removing the pin reddens it 5 of 5.
Noticed, not filed:
SharedFixedHashTableRuntimeFilterhas no full-disable path at all.Version info
26.8.1.1181(included in26.8and later)