Skip to content

Do not add serialize_query_plan to the upgrade check's randomized options - #119406

Merged
PedroTadim merged 1 commit into
ClickHouse:masterfrom
groeneai:no-serialize-query-plan-in-upgrade-check
Sep 11, 2026
Merged

PedroTadim merged 1 commit into
ClickHouse:masterfrom
groeneai:no-serialize-query-plan-in-upgrade-check

Conversation

@groeneai

@groeneai groeneai commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #110518
Related: #118093
Related: #119372
Related: #116783

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 into CHANGELOG.md):

The stress option generator no longer sends serialize_query_plan=1 to the upgrade check's pre-upgrade load, whose server is a frozen previous release that aborts on that path.

Description

Upgrade check (amd_release) runs on every PR and lost its server on ~18% of them today.
By distinct commit_sha: 0 of the 3454 shas running the check from 08-30 to 09-10
carry Got read request from replica 0 for unknown stream ...
(ParallelReplicasReadingCoordinator.cpp:1316), then 24 of 133 today to 08:00Z. The abort
kills the server, so the job reports "Server died" and loses its remaining assertions
(run).

#116783, merged 2026-09-10 14:19Z, hours before the first affected run, added a nested
serialize_query_plan=1 draw to the option generator's parallel-replicas arm without the
not upgrade_check guard its siblings carry. Its only test load runs against the previous
release
server (now v26.8.2.7), which aborts on that path: no change to master can clear it
here. This closes the generated route: --no-random-settings is passed under upgrade_check,
and the server-side profile needs --parallel-rep, never passed here. Two tests in the
replayed corpus do set it themselves (04043, 04227), but they pin their own cluster, sat
unchanged across the clean 3454 shas, and in 90 days no unknown stream abort in any check
names their tables. #116783's 50x memory_tracker_fault_probability raise scales to ~2 runs
a day, not 24.

The guard matches the sibling arms in the same function, including #116783's own
enable_cascades_optimizer. Coverage stays where a failure is actionable: the draw keeps
firing in Stress test (*) against the PR's own build (0 of 265 shas since).

Validation: 4000 get_options draws per condition move serialize_query_plan 388 -> 0 under
upgrade_check, leaving enable_parallel_replicas and the upgrade_check=False counts
unchanged. The abort does not reproduce in a local single-process pseudo-cluster (~1500
queries), so the case rests on the measurement above; #119372 has a deterministic reproducer.

cc @PedroTadim (#116783's author): the coverage it added is fine; this only keeps the setting
out of the one job that reaches a frozen release.


Workflow [PR]
Sync PR [sync-upstream/pr/119406]

Version info

  • Merged into: 26.9.1.1192 (included in 26.9 and later)

… load

Upgrade check (amd_release) runs on every pull request and began losing its
server on roughly one run in five on 2026-09-11: 24 of 126 shas that day
carried 'Got read request from replica 0 for unknown stream ...'
(ParallelReplicasReadingCoordinator.cpp:1316), against 0 of 3457 shas over the
preceding twelve days. The abort kills the server, so the job reports
"Server died" and loses every remaining assertion in it.

The cause is a harness change, not an engine change. ClickHouse#116783 added a nested
serialize_query_plan=1 draw inside the stress option generator's
parallel-replicas arm without the 'not upgrade_check' guard its sibling arms
carry. The upgrade check's only test load runs against the previous release
server, resolved at run time (currently v26.8.2.7), and that shipped binary
aborts on the serialized-plan parallel-replicas path. Because the defect is in
a released binary, no change to master can clear it from this job, which is
what makes the red permanent rather than a bug report.

The same option on a current build is not implicated: over 09-04 to 09-11
Stress test (*), which gets the identical arm at the identical probability
against the PR's own build, produced 0 to 1 affected shas per day out of 259
to 483, and the signature has no true-master occurrences in 30 days. So the
guard is added rather than the arm removed: classic parallel-replicas coverage
in the upgrade check is preserved, and serialize_query_plan coverage continues
in every Stress test flavour, where a failure names a fixable defect.

This matches the convention used seven times in the same function, including
the enable_cascades_optimizer arm ClickHouse#116783 itself added for the same reason.

Verified by executing get_options 4000 times per condition: under
upgrade_check, serialize_query_plan goes from 388 to 0, while
enable_parallel_replicas stays at 820, confirming the guard did not land on
the outer draw, and the upgrade_check=False counts are unchanged.

Related: ClickHouse#118093
Related: ClickHouse#119372
Related: ClickHouse#110518

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 11, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: claude; 0 findings; it read the whole
get_options function and every sibling upgrade_check guard), plus my own cold review of the
resulting diff, which found four nits and no blocker or major.

# Sev Finding Verdict Evidence / action
1 💡 The draft body quoted same-day rates (3457 shas, 24 of 126, 19.0%) measured while the day was still running AGREE, fixed Re-measured at 08:00Z and rewritten with its cutoff: 0 of 3454 shas from 08-30 to 09-10, 24 of 133 today, and 0 of 265 Stress test shas since the #116783 merge
2 💡 The provenance links sat inside the template's HTML comment, so they would not render AGREE, fixed Comment block removed; the three issues and #116783 are now visible at the top of the body
3 💡 The commit message calls this "the convention used seven times in the same function"; the function holds six not upgrade_check guards plus one positive if upgrade_check: branch AGREE, not blocking Left as written rather than spending a round on a count; the body says "matches the sibling arms in the same function", which is exact
4 💡 The hunk adds three comment lines against one line of code, past the comment density I hold myself to DISAGREE The two added lines state why the predicate is upgrade_check at all, which is not inferable from the code, and the sibling enable_cascades_optimizer arm carries the same two-line form at stress.py:541-543

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

One thing I noticed and am deliberately not raising: #116783 also raised five fault-injection
probabilities by 10x to 50x, and those arms are not guarded under upgrade_check either, so they
too exercise the frozen release. No CIDB row is attributable to any of them, so there is nothing
to fix there yet.

Session id: cron:clickhouse-review-slot-9:20260911-074700

@clickhouse-gh clickhouse-gh Bot closed this Sep 11, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 11, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 11, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes for the defect fixed here: get_options(upgrade_check=True) emits serialize_query_plan=1 on 388/4000 draws at HEAD and 0/4000 patched. The engine abort that option triggers lives in a released binary and does not reproduce in a single-process pseudo-cluster (~1500 queries against a local v26.8.2.7 server); it is tracked in #119372 and is not what this PR changes.
b Root cause explained? Yes. #116783 added a nested serialize_query_plan=1 draw to the parallel-replicas arm without the not upgrade_check guard its siblings carry. The upgrade check's only test load runs against the previous release, whose serialized-plan parallel-replicas path aborts at ParallelReplicasReadingCoordinator.cpp:1316, killing the server and losing the job's remaining assertions.
c Fix matches root cause? Yes. The regression is an unguarded option emission, and the guard is added at that emission. Not a log-scrub allow-list, not a widened bound, and not a suppression of the LOGICAL_ERROR itself, which would have turned one signal loss into a permanent one.
d Test intent preserved / new tests added? Yes. enable_parallel_replicas still fires at 820/4000 under upgrade_check, so classic parallel-replicas coverage there is intact, and serialize_query_plan coverage is untouched in every Stress test (*) flavour. A ci/ option generator has no SQL test; the oracle is a direct behavioural check of get_options.
e Both directions demonstrated? Yes. Unpatched: 388/4000 emissions under upgrade_check. Patched: exactly 0. Two controls hold in both directions: enable_parallel_replicas stays at 820 (the guard did not land on the outer if) and the upgrade_check=False counts are unchanged at 385/786.
f Fix is general across code paths? Yes. get_options has one caller (run_func_test), reached with upgrade_check=True from one place (run_stress_test(upgrade_check=True)), and job_configs.py parametrizes amd_release only, so there is no sibling job or second option generator. Every other option #116783 added or raised was enumerated and dispositioned; those left alone have no attributable CIDB rows.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A for a CI option generator (no data types or parameter matrix). The oracle does sweep the one input that exists, worker index i % 8, over 4000 draws for both values of upgrade_check.
h Backward compatible? Yes, trivially: CI-only. No setting default changes, so no SettingsChangesHistory.cpp entry, no format versioning, no gate.
i Invariants and contracts preserved? Yes. get_options still returns a well-formed option string on every path (8000 executions, no exceptions); the guard removes one token from one arm. The invariant established: an option that steers the pre-upgrade load onto a distributed execution path must not be emitted when upgrade_check is true, because the server it reaches is a frozen release.

Session id: cron:clickhouse-impl-slot-4:20260911-070900

@clickhouse-gh

clickhouse-gh Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5620afa]

Summary: ✅


AI Review

Summary

This PR stops get_options from randomly adding serialize_query_plan=1 to upgrade-check workers, which should remove the new broad source of old-binary aborts. But the change does not satisfy the stronger contract implied by the title/body: the previous-release query suite still contains untagged tests that explicitly enable serialized plans, including parallel-replica cases, so the pre-upgrade load can still reach the frozen-release plan-shipping path.

Findings

⚠️ Majors

  • [ci/jobs/scripts/stress/stress.py:512] The new guard only removes the harness-generated serialize_query_plan=1, but upgrade_runner.sh still replays the v26.8.2.7-lts query suite and that suite has untagged tests that explicitly set serialize_query_plan = 1 on distributed / parallel-replica reads, including 0_stateless/04043_materialized_cte_serialize_query_plan.sql and 0_stateless/04227_pr_materialized_cte_set_subquery.sql. So the pre-upgrade load can still send serialized plans to the frozen release, which violates the PR's stated contract and leaves the same unfixable surface exposed.
    Suggested fix: either skip or override those previous-release tests under --upgrade-check, or narrow the PR title/description/commit message to "stop the random option generator from adding serialize_query_plan=1" so the advertised contract matches the code.
Final Verdict

⚠️ One major issue remains: the patch narrows only the randomizer path, while explicit previous-release serialize_query_plan=1 tests are still runnable in the upgrade check. Either broaden the harness change to cover those cases too, or narrow the PR promise to the smaller fix.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 11, 2026
# Ship serialized query plans to the replicas instead of query text. The upgrade
# check's only test load runs against the previous release, so a failure on this
# path there cannot be fixed by any change to master.
if random.random() < 1 / 2 and not upgrade_check:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guard only removes the harness-generated serialize_query_plan=1; it does not keep the upgrade check's pre-upgrade load off serialized plans entirely. The v26.8.2.7-lts query suite that upgrade_runner.sh replays still has untagged tests that explicitly set serialize_query_plan = 1 together with distributed / parallel-replica reads, for example 0_stateless/04043_materialized_cte_serialize_query_plan.sql and 0_stateless/04227_pr_materialized_cte_set_subquery.sql. Because those tests are still runnable under --upgrade-check, the frozen release can still enter the same unfixable surface; either skip or override those cases too, or narrow the PR title/body to "stop the random option generator from adding serialize_query_plan=1".

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both premises check out; the conclusion does not.

True: at v26.8.2.7-lts both files are in the replayed corpus and both carry SET serialize_query_plan = 1 with no -- Tags: line. And the guard does only remove the generated draw.

Refuted: those two tests have never produced this abort.

  • They are byte-identical at v26.8.1.2041-lts (08-30) and v26.8.2.7-lts (09-01), sha256 4c8ace62aef25ce7 and 08040686da9279f9, so they sat unchanged in the corpus across the entire clean window: 0 unknown-stream aborts in Upgrade check (amd_release) over the 3454 shas from 08-30 to 09-10, then 24 in one day starting hours after More settings and disruptions to randomize in stress tests #116783 merged. A constant cannot produce a step change.
  • Over 90 days no unknown stream abort in any check names pr_04043 or pr_cte_04227. The 8 CIDB rows that mention those tables at all are Fast test / Stateless / AST fuzzer failures with unrelated signatures (UNSUPPORTED_METHOD, Code: 241, a materialized-CTE gate error). Positive controls in the same query: 31 rows naming t_mt_index_rp, 278 containing for unknown stream. All 27 aborts name t_mt_index_rp.
  • Why the asymmetry: the generator injects enable_parallel_replicas=1 ... cluster_for_parallel_replicas='parallel_replicas' as client options into every test (stress.py:504-508, itself unguarded), which is how 04891, a test that never mentions parallel replicas, reaches the coordinator on table t_mt_index_rp. 04043 and 04227 instead pin their own cluster and parallel-replicas settings in the query body, and query-level settings beat client-level injection.

"skip or override those cases too" has no mechanism: no-upgrade-check does not exist in clickhouse-test (the only thing --upgrade-check changes there is --fake-drop, tests/clickhouse-test:7738), and the corpus is a --depth=1 clone of the release tag (upgrade_runner.sh:44) consumed via --queries=previous_release_repository/tests/queries, so a tag added to master's copy cannot reach the job that is failing.

"narrow the title/body" is right, and done. The title is now "Do not add serialize_query_plan to the upgrade check's randomized options". The body claimed "Nothing else in this job sets it", enumerating the randomizer and the server-side profile but not the replayed test bodies; that was wrong, and it now names that route with the measurement above.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 11, 2026
@groeneai groeneai changed the title Do not ship serialized query plans in the upgrade check's pre-upgrade load Do not add serialize_query_plan to the upgrade check's randomized options Sep 11, 2026
@PedroTadim

Copy link
Copy Markdown
Member

I am going to merge this, just to relax the CI

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 comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding manual approve Manual approve required to run CI 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