Repository navigation
Block disabling the analyzer in the Stress test and fuzzers more tightly - #115328
Conversation
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]>
|
Workflow [PR], commit [93627e2] Summary: ✅ AI ReviewSummaryThis PR pins Findings
Final VerdictChanges 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 |
There was a problem hiding this comment.
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.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
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 units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
The Stress test and the AST fuzzer (and BuzzHouse, which installs the same profile) already constrain
enable_analyzerto<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.
compatibilityset below 24.3 — the version where the analyzer became the default — rewrites every setting that is not markedchanged, so it revertsenable_analyzerto 0 without an explicit change and the constraint never fires. With the Stress test profile as it is now:The AST fuzzer profile is immune because it also pins the value (
<enable_analyzer>1</enable_analyzer>), which keeps the settingchangedso thatapplyCompatibilitySettingskips it. The Stress test profile had no such pin and relied only on the client-sideenable_analyzer=1thatstress.pypasses, whilestress.pyrandomizescompatibilitydown 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.pystill described areadonlyconstraint that was replaced withminin 0378206.The new test builds the same pinned and constrained profile in SQL and checks that:
SET, an in-querySETTINGSclause, theallow_experimental_analyzeralias, the client command line, settings stored in a view);enable_analyzer = 1sent together withcompatibilityis still accepted — aCONSTconstraint rejects it, which is whyminis used;compatibilitydoes not revert the pinned value.Not addressed here:
SET <setting> = DEFAULTis not checked against constraints at all (resetSettingsToDefaultValue), soSET compatibility = '23.2'; SET enable_analyzer = DEFAULTstill gets through. That is a server-side bypass of settings constraints in general and is fixed separately.Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/115328]
Version info
26.8.1.1675(included in26.8and later)