Skip to content

Block disabling the analyzer in the Stress test and fuzzers more tightly - #115328

Merged
alexey-milovidov merged 1 commit into
masterfrom
block-analyzer-disable-stress-fuzzers
Aug 19, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
block-analyzer-disable-stress-fuzzers

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

The Stress test and the AST fuzzer (and BuzzHouse, which installs the same profile) already constrain enable_analyzer to <min>1</min> so that neither a test nor a fuzzed query spends the run on the old interpreter.

A constraint only rejects an explicit setting change though. compatibility set below 24.3 — the version where the analyzer became the default — rewrites every setting that is not marked changed, so it reverts enable_analyzer to 0 without an explicit change and the constraint never fires. With the Stress test profile as it is now:

SET compatibility = '23.2'; SELECT getSetting('enable_analyzer')   -->  false
/?compatibility=23.2&query=SELECT getSetting('enable_analyzer')    -->  false

The AST fuzzer profile is immune because it also pins the value (<enable_analyzer>1</enable_analyzer>), which keeps the setting changed so that applyCompatibilitySetting skips it. The Stress test profile had no such pin and relied only on the client-side enable_analyzer=1 that stress.py passes, while stress.py randomizes compatibility down to 20.1.

This pins the value in the Stress test profile too, and documents in all four places why both halves are needed, so that neither is later removed as redundant. The comment in ast_fuzzer_job.py still described a readonly constraint that was replaced with min in 0378206.

The new test builds the same pinned and constrained profile in SQL and checks that:

  • every explicit way of disabling the analyzer is rejected (SET, an in-query SETTINGS clause, the allow_experimental_analyzer alias, the client command line, settings stored in a view);
  • a no-op enable_analyzer = 1 sent together with compatibility is still accepted — a CONST constraint rejects it, which is why min is used;
  • a pre-24.3 compatibility does not revert the pinned value.

Not addressed here: SET <setting> = DEFAULT is not checked against constraints at all (resetSettingsToDefaultValue), so SET compatibility = '23.2'; SET enable_analyzer = DEFAULT still gets through. That is a server-side bypass of settings constraints in general and is fixed separately.

Changelog category (leave one):

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

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

Version info

  • Merged into: 26.8.1.1675 (included in 26.8 and later)

The Stress test and the AST fuzzer (and BuzzHouse, which installs the same
profile) already constrain `enable_analyzer` to `<min>1</min>` so that neither a
test nor a fuzzed query spends the run on the old interpreter.

A constraint only rejects an *explicit* setting change though. `compatibility`
set below 24.3 - the version where the analyzer became the default - rewrites
every setting that is not marked `changed`, so it reverts `enable_analyzer` to 0
without an explicit change and the constraint never fires. With the Stress test
profile as it is now:

    SET compatibility = '23.2'; SELECT getSetting('enable_analyzer')   -->  false
    /?compatibility=23.2&query=SELECT getSetting('enable_analyzer')    -->  false

The AST fuzzer profile is immune because it also pins the value
(`<enable_analyzer>1</enable_analyzer>`), which keeps the setting `changed` so
that `applyCompatibilitySetting` skips it. The Stress test profile had no such
pin and relied only on the client-side `enable_analyzer=1` that `stress.py`
passes, while `stress.py` randomizes `compatibility` down to 20.1.

Pin the value in the Stress test profile too, and document in all four places
why both halves are needed, so that neither is later removed as redundant. The
comment in `ast_fuzzer_job.py` still described a `readonly` constraint that was
replaced with `min` in 0378206.

Add a test that builds the same pinned and constrained profile in SQL and checks
that every explicit way of disabling the analyzer is rejected, that a no-op
`enable_analyzer = 1` sent together with `compatibility` is still accepted (a
`CONST` constraint rejects it, which is why `min` is used), and that a pre-24.3
`compatibility` does not revert the pinned value.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [93627e2]

Summary: ✅


AI Review

Summary

This PR pins enable_analyzer in the stress/fuzzer profiles and adds a stateless regression test for the compatibility path. The main idea is correct, but the remaining name = DEFAULT bypass still lets those harnesses clear the pin's changed bit and then fall back to the old interpreter on a later old compatibility setting, so I do not think the promised invariant holds yet.

Findings
  • ⚠️ [tests/queries/0_stateless/05022_analyzer_constraint_survives_compatibility.sh:40] SET enable_analyzer = DEFAULT is still a reachable bypass for the new invariant. Context::resetSettingsToDefaultValue applies default_settings without constraint checks (src/Interpreters/Context.cpp:3513), so the reset clears the profile pin's changed bit. The existing corpus file tests/queries/0_stateless/03243_compatibility_setting_with_alias.sql:1-7 already does that before SET compatibility = '24.1', and its reference ends with enable_analyzer = 0, which means both the stress test and the AST fuzzer can still spend the rest of that file on the old interpreter after this PR.
    Suggested fix: either enforce constraints for default_settings / SET ... = DEFAULT, or strip/reject enable_analyzer = DEFAULT and allow_experimental_analyzer = DEFAULT in the harnesses, then add that exact regression sequence to the new stateless test.
Final Verdict

Changes requested.

# check from filtering unchanged settings, so this is the case a CONST constraint would break
${CLICKHOUSE_CLIENT} --user="${USER}" --compatibility='23.8' --enable_analyzer=1 -q "SELECT getSetting('enable_analyzer')"

# A pre-24.3 compatibility does not revert the pinned value

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 still misses the reachable name = DEFAULT bypass for the same invariant. Context::resetSettingsToDefaultValue applies default_settings without running the settings constraints (src/Interpreters/Context.cpp:3513), so SET enable_analyzer = DEFAULT (or the alias form) clears the profile pin's changed bit instead of being rejected. After that, a later old compatibility setting can revert the session back to enable_analyzer = 0.

That is not theoretical for these harnesses: the existing corpus file tests/queries/0_stateless/03243_compatibility_setting_with_alias.sql already does SET enable_analyzer = DEFAULT and then SET compatibility = '24.1', and its reference ends with enable_analyzer = 0. So the AST fuzzer and the stress test can still spend the rest of that file on the old interpreter after this PR.

I think this needs either a real fix for constrained name = DEFAULT, or a harness-side strip/reject for enable_analyzer/allow_experimental_analyzer = DEFAULT, plus a regression case here for that exact sequence.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We fix it in #115334.

@clickhouse-gh

clickhouse-gh Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 93627e238 with master 3436fefff (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 701.97 MiB 698.94 MiB -3.03 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov self-assigned this Aug 19, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 19, 2026
Merged via the queue into master with commit 00b7289 Aug 19, 2026
185 checks passed
@alexey-milovidov
alexey-milovidov deleted the block-analyzer-disable-stress-fuzzers branch August 19, 2026 00:24
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants