Skip to content

Fix flaky test 02967_parallel_replicas_joins_and_analyzer - #100867

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:fix/02967-parallel-replicas-joins-flaky
Mar 27, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:fix/02967-parallel-replicas-joins-flaky

Conversation

@groeneai

@groeneai groeneai commented Mar 27, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

  • none

What this PR does

Pin enable_join_runtime_filters = 1 in the test setup to prevent the CI test randomizer from disabling runtime filters (~5% probability), which removes BuildRuntimeFilter nodes from the EXPLAIN output and restructures the join plan, causing a reference mismatch.

Root cause

The CI test runner randomizes enable_join_runtime_filters with a 5% probability of False (line 1406 of tests/clickhouse-test). When disabled, the query planner omits the BuildRuntimeFilter optimization step, restructuring the entire join tree in the EXPLAIN output. Since this test verifies EXPLAIN plans that include BuildRuntimeFilter, the output no longer matches the .reference file.

CIDB evidence: All 36 failures in the last 30 days (across 9+ unrelated PRs and 2 master hits) had --enable_join_runtime_filters False in their randomized settings — 100% correlation.

How the fix works

Adding SET enable_join_runtime_filters = 1 before -- { echoOn } ensures the plan always includes BuildRuntimeFilter nodes regardless of CI randomization. The test-level SET takes precedence over CLI settings injected by the runner.

Verification

  • Deterministic reproduction: CLICKHOUSE_CLIENT_OPT="--enable_join_runtime_filters 0" causes 100% failure rate without the fix
  • Fix validation: Same injection → 100% pass rate with the fix
  • Stress test: 50/50 passes with full randomization enabled

🤖 Generated with Claude Code

Version info

  • Merged into: 26.4.1.318

Pin enable_join_runtime_filters=1 because the test checks EXPLAIN
output containing BuildRuntimeFilter nodes. The CI randomizer
disables this setting ~5% of the time, removing the filter node
and restructuring the join plan, causing reference mismatch.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pre-PR Validation Gate

Session: cron:clickhouse-ci-task-worker:20260327-063214

# Question Answer
a Deterministic repro? ✅ CLICKHOUSE_CLIENT_OPT="--enable_join_runtime_filters 0 --allow_repeated_settings" → 100% failure
b Root cause explained? ✅ enable_join_runtime_filters=False (5% CI random) removes BuildRuntimeFilter from EXPLAIN plan, restructuring join tree → reference mismatch
c Fix matches root cause? ✅ SET enable_join_runtime_filters = 1 in test setup directly prevents the plan change
d Test intent preserved? ✅ Test verifies parallel replicas join plan splitting — runtime filters are part of the expected plan, not the thing being tested
e Both directions? ✅ Fails without fix + setting=0, passes with fix + setting=0. 50/50 with full randomization

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @nickitat — could you review this? It pins enable_join_runtime_filters=1 in the parallel replicas join test to prevent ~5% CI flakiness when the randomizer disables runtime filters, removing BuildRuntimeFilter from the EXPLAIN output.

@Algunenano Algunenano self-assigned this Mar 27, 2026
@Algunenano Algunenano added the can be tested Allows running workflows for external contributors label Mar 27, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bd46bbf]

Summary: ✅


AI Review

Summary
This PR fixes flakiness in 02967_parallel_replicas_joins_and_analyzer by pinning enable_join_runtime_filters = 1 in test setup, stabilizing EXPLAIN output under randomized CI settings. The change is minimal, targeted, and appropriate for a CI-only fix; I did not find correctness, safety, or maintainability issues in the patch.

ClickHouse Rules

Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ➖
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅

Final Verdict

  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 27, 2026
@Algunenano
Algunenano added this pull request to the merge queue Mar 27, 2026
Merged via the queue into ClickHouse:master with commit 9a0c3fe Mar 27, 2026
149 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants