Repository navigation
Remove strange trash (again) - #108657
Remove strange trash (again)#108657
Conversation
The automatic value of settings like `max_threads` shows up in `system.settings` as `'auto(64)'` - with literal single quotes baked right into the string value. They are pure garbage and have annoyed me for years. Back in 2023 I removed them in a commit titled, with great restraint, "Fix strange trash". Konstantin promptly put the trash back in #68979 (branch `put-strange-trash-back`, commit "Revert \"Fix strange trash\""). And, in fairness, he was right at the time: the parser only understood the quoted form, so a new un-quoted server could not parse the `'auto(N)'` that older replicas send over the wire as a setting string, which broke mixed-version clusters (#68748). That obstacle is now gone. `stringToMaxThreads` accepts both `auto(N)` and the legacy `'auto(N)'`, so emitting the clean form is safe in both directions: an old replica's quoted value is still parsed by us, and every released version can already parse the un-quoted value we now send. So the strange trash goes back out - and this time the tolerant parser stays, so it stays out for good. Changes: - `SettingFieldMaxThreads::toString` now returns `auto(N)` without quotes. - Documented why `stringToMaxThreads` must keep accepting the legacy quoted form (it is the mixed-version-cluster compatibility guarantee). - Updated test `04202_set_default_preserves_max_threads_auto` and the `test_cgroup_limit` integration test to match the clean form. - The upgrade check (`upgrade_runner.sh`) now ignores `auto(...)` values when diffing settings against the previous release, so the quoted-vs-unquoted rendering is not reported as a setting change. - Updated the `system.settings` example in the docs. Related: #68748 Related: #68979 Related: #52503 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [66c396f] Summary: ✅
AI ReviewSummaryThis PR changes Final VerdictStatus: ✅ Approve |
…ifference Address review (AI Review "Request changes"): the upgrade settings-history check excluded every changed setting whose new value contained `auto(` (`new_value NOT LIKE '%auto(%'`). That is broader than the intended quoted-to-unquoted rendering change, so a genuine default change to an `auto(N)` value (e.g. `4` -> `auto(8)`, or a brand-new auto-defaulted setting) could escape the required `SettingsChangesHistory.cpp` entry. Suppress only the pure rendering difference: a row where the old value is exactly the new value wrapped in single quotes (the legacy `'auto(N)'` form). A genuine change of an auto-valued setting's default is still reported. Applied to both the `system.settings` and `system.merge_tree_settings` queries. Verified with `clickhouse-local` that the new condition drops the quote-only difference and keeps genuine changes and brand-new auto settings. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The cross-version compatibility guarantee of this change is that `stringToMaxThreads` keeps accepting both the clean `auto(N)` form and the legacy `'auto(N)'` form (single quotes baked into the string value) that older replicas send over the wire. The existing tests only assert the new `system.settings` display form, so a regression that drops the `startsWith(str, "'auto")` branch in `stringToMaxThreads` would still pass while silently breaking mixed-version clusters. The new test `04416_max_threads_auto_parsing_compat` feeds both forms through the parsing path (`SET max_threads = 'auto(8)'` and the legacy `SET max_threads = '''auto(8)'''`) and asserts the setting stays auto and renders without quotes, across the `SettingFieldMaxThreads` family. If the legacy branch is removed, `SET max_threads = '''auto(8)'''` throws a parse error and the test fails loudly. Addresses review feedback on #108657 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The in-flight PR #108657 already claims `04416` (`04416_max_threads_auto_parsing_compat`), so move the atomic-populate tests off it to the next free pair (`04418`/`04419`) and update the internal `create_err` temp-file reference.
After merging master, `04416_max_threads_auto_parsing_compat` collided with several `04416_*` tests added on master. Renumber it to the next free number (`04489`).
|
Merged the latest The sole CI failure — |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 6/6 (100.00%) | Lost baseline coverage: none · Uncovered code |
…part_log_flush` The stateless test `04341_broken_mutation_part_log_flush` runs an intentionally-failing async mutation `ALTER TABLE ... UPDATE x = x + throwIf(1) WHERE 1` (expecting `serverError UNFINISHED`) to assert that the failed `MutatePart` `part_log` entry is flushed before the failure is reported to the client. After the upgrade restart the broken mutation is retried in the background and logs `Value passed to 'throwIf' function is non-zero` (`FUNCTION_THROW_IF_VALUE_IS_NON_ZERO`, Code: 395) to `clickhouse-server.upgrade.log`, which fails the `Upgrade check` with `Error message in clickhouse-server.log (see upgrade_error_messages.txt)`. This is the expected test-induced error, not a backward incompatibility or a regression - exactly the same class as the `CANNOT_PARSE_TEXT` mutation errors already allowlisted (issue ClickHouse#39174). Note the table uses a plain `MergeTree`, so the error is emitted by `MutatePlainMergeTreeTask` and is not covered by the existing `MutateFromLogEntryTask` exclusion. `throwIf` only raises when a query explicitly calls it with a truthy argument, so the message can only come from such a test, never from an upgrade incompatibility; the narrow message substring also covers the wrapping `MergeTreeBackgroundExecutor` line. The failure is not caused by any product change - it surfaces on any pull request that runs the Upgrade check. Observed master-wide on ~19 distinct pull requests over the four days 2026-06-26..2026-06-29 (confirmed via play.clickhouse.com `checks` history), e.g. PR ClickHouse#108657. This mirrors the earlier allowlist additions for `04338` ('x'), `01414` ('Hello') and `00834` ('a'/'b'). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The cross-version compatibility guarantee of this change is that `stringToMaxThreads` keeps accepting both the clean `auto(N)` form and the legacy `'auto(N)'` form (single quotes baked into the string value) that older replicas send over the wire. The existing tests only assert the new `system.settings` display form, so a regression that drops the `startsWith(str, "'auto")` branch in `stringToMaxThreads` would still pass while silently breaking mixed-version clusters. The new test `04416_max_threads_auto_parsing_compat` feeds both forms through the parsing path (`SET max_threads = 'auto(8)'` and the legacy `SET max_threads = '''auto(8)'''`) and asserts the setting stays auto and renders without quotes, across the `SettingFieldMaxThreads` family. If the legacy branch is removed, `SET max_threads = '''auto(8)'''` throws a parse error and the test fails loudly. Addresses review feedback on ClickHouse#108657 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…rash-again Remove strange trash (again)
…part_log_flush` The stateless test `04341_broken_mutation_part_log_flush` runs an intentionally-failing async mutation `ALTER TABLE ... UPDATE x = x + throwIf(1) WHERE 1` (expecting `serverError UNFINISHED`) to assert that the failed `MutatePart` `part_log` entry is flushed before the failure is reported to the client. After the upgrade restart the broken mutation is retried in the background and logs `Value passed to 'throwIf' function is non-zero` (`FUNCTION_THROW_IF_VALUE_IS_NON_ZERO`, Code: 395) to `clickhouse-server.upgrade.log`, which fails the `Upgrade check` with `Error message in clickhouse-server.log (see upgrade_error_messages.txt)`. This is the expected test-induced error, not a backward incompatibility or a regression - exactly the same class as the `CANNOT_PARSE_TEXT` mutation errors already allowlisted (issue ClickHouse#39174). Note the table uses a plain `MergeTree`, so the error is emitted by `MutatePlainMergeTreeTask` and is not covered by the existing `MutateFromLogEntryTask` exclusion. `throwIf` only raises when a query explicitly calls it with a truthy argument, so the message can only come from such a test, never from an upgrade incompatibility; the narrow message substring also covers the wrapping `MergeTreeBackgroundExecutor` line. The failure is not caused by any product change - it surfaces on any pull request that runs the Upgrade check. Observed master-wide on ~19 distinct pull requests over the four days 2026-06-26..2026-06-29 (confirmed via play.clickhouse.com `checks` history), e.g. PR ClickHouse#108657. This mirrors the earlier allowlist additions for `04338` ('x'), `01414` ('Hello') and `00834` ('a'/'b'). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Related: #68748
Related: #68979
Related: #52503
The automatic value of
max_threads(and friends:max_final_threads,max_parsing_threads,max_part_loading_threads, ...) has for years been shown insystem.settingslike this:Note the single quotes. They are inside the value - a
Stringcolumn carrying the literal characters'auto(8)'. This is strange trash.A short history of the strange trash, in three acts:
put-strange-trash-back, commit "Revert "Fix strange trash""). In fairness, he was right: at that moment the parser only recognized the quoted form, so a new un-quoted server choked on the'auto(N)'that older replicas send over the wire - settings travel between servers as their string representation and are re-parsed - and mixed-version clusters broke (Incorrect parsing of setting value between mixed versions #68748).stringToMaxThreadsnow accepts bothauto(N)and the legacy'auto(N)'. So we can finally emit the clean form while still understanding the quoted form an older replica sends, and every released version can already parse the un-quoted form we send. The strange trash goes back out - and this time the tolerant parser stays, so it stays out for good.The result:
What's included:
SettingFieldMaxThreads::toStringreturnsauto(N)without quotes.stringToMaxThreadsexplaining the quoted form must remain parseable (it is the mixed-version-cluster compatibility guarantee).04202_set_default_preserves_max_threads_autoandtest_cgroup_limitupdated to the clean form.upgrade_runner.sh) now ignoresauto(...)values when diffing settings against the previous release, so the rendering change is not reported as a setting change.system.settingsexample in the docs updated.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The automatic value of
max_threadsand similar settings is now shown insystem.settingsasauto(8)instead of'auto(8)'; the surrounding single quotes were a long-standing artifact baked into the value. Cross-version compatibility is preserved: the legacy quoted form is still accepted when parsing settings received from older servers.Documentation entry for user-facing changes
system.settingsexample indocs/en/operations/settings/overview.mdis updated)Version info
26.7.1.281(included in26.7and later)