Skip to content

Cherry pick #131636 to 26.8: Skip a setting value from the server's Hello that this version rejects instead of failing the connection - #132960

Merged
robot-ch-test-poll merged 4 commits into
backport/26.8/131636from
cherrypick/26.8/131636
Nov 22, 2026
Merged

robot-ch-test-poll merged 4 commits into
backport/26.8/131636from
cherrypick/26.8/131636

Conversation

@robot-ch-test-poll

Copy link
Copy Markdown
Contributor

Original pull-request #131636

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

groeneai and others added 3 commits November 14, 2026 12:50
Since #131269 a `Seconds` setting rejects a negative or overflowing value,
while every supported older release accepts and stores one, and its
`TCPHandler::sendHello` sends the user's changed settings in `Hello`.
`Connection::receiveHello` read them with the same strict `BaseSettings::read`
the server uses for a client's query settings, so a client or an initiator
with #131269 could not connect at all to an older server whose user or
profile has e.g. `max_execution_time = -1` (`Code: 36 ... cannot be negative`).
An unknown non-important setting from the server was already only a warning.

`BaseSettings::read` gets an opt-in `skip_invalid_values`: in the
`STRINGS_WITH_FLAGS` branch the value string is read first, and if parsing
it throws `BAD_ARGUMENTS` or a parse error (`isParseError`, the same
classification `insertPostgreSQLValue` uses) for a non-important setting,
the field is reset to its default and a warning is logged. The reset is
needed because `SettingFieldNonZeroUInt64::parseFromString` assigns before it
throws. Any other exception, and an `IMPORTANT` setting (the rule the
unknown-setting branch already applies), still fail the read. Only
`Connection::receiveHello` opts in: the settings in `Hello` are advisory for
the client (the server applies its own profile to every query), while the
server's read of a client's settings must keep rejecting `-1` (#131194).

Tests: a gtest for the tolerant read (a rejected `Seconds` value, a zero
`NonZeroUInt64`, an unparsable `Bool`, a valid setting after them, the strict
default, an `IMPORTANT` flag, and an unknown enum name (`load_balancing`),
which still fails the tolerant read), and a `test_backward_compatibility` case
with a 25.3 node: a user with `max_execution_time = -1`, reached by the tested
client and by a tested `remote()` initiator. The test uses
`query_and_get_answer_with_error` because the client prints the warning on
stderr.

Closes #131506
Related #131269, #131194

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…skip-invalid-values

Resolve the conflicts with #131099, which removed `SettingsWriteFormat`:
`BaseSettings::read` and `Settings::read` now take only `skip_invalid_values`,
and the tolerant parse applies to the single remaining string path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lid-values

Skip a setting value from the server's Hello that this version rejects instead of failing the connection
@robot-ch-test-poll robot-ch-test-poll added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Nov 19, 2026
Resolve the conflicts of the cherry-pick of #131636. 26.8 still has
`SettingsWriteFormat` (master removed it in #131099), so `read` keeps its
`format` argument and takes `skip_invalid_values` after it, as in the
first commit of #131636 (669fb8d), which was written against this API.

The new gtest goes right after `SecondsOnTheWireRejectNegativeAndOverflowingValues`.

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

Copy link
Copy Markdown
Collaborator

The conflicts come from #131099 (it removed SettingsWriteFormat on master), which is not on 26.8, so a retry of the cherry-pick would conflict the same way. The resolution keeps the format argument of read and adds skip_invalid_values after it, as in the first commit of #131636 (669fb8d140ab), which was written against this API.

git fetch https://github.com/groeneai/ClickHouse resolve-26.8-cherrypick-131636 && git push origin FETCH_HEAD:cherrypick/26.8/131636
  • 7b8ff2f9164c merges backport/26.8/131636 into the cherry-pick head e221bba849bc, so the push is a fast-forward. Compared with backport/26.8/131636 it changes the same 7 files as Skip a setting value from the server's Hello that this version rejects instead of failing the connection #131636, with the same added and removed lines as 669fb8d140ab. The new gtest goes right after SecondsOnTheWireRejectNegativeAndOverflowingValues, as on master.
  • On a 26.8 build (Debug, clang-22) the settings gtests pass (16/16, including Settings.SkipInvalidValuesKeepsTheDefaultsAndReadsTheRest). Against a 25.3 server whose user has max_execution_time = -1, the client and a remote() initiator of this build succeed and log Cannot parse the value of setting max_execution_time, skipping it, while the official 26.8.42.13 binary fails both with Code: 36 ... cannot be negative.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Pushed the resolution from the comment above as a fast-forward: 7b8ff2f9164c (parents e221bba849bc and d93e5c270a30). Against backport/26.8/131636 it changes only the 7 files of #131636 and keeps the SettingsWriteFormat argument of read, which 26.8 still has. A -fsyntax-only check of BaseSettings.cpp, Settings.cpp, Connection.cpp and gtest_settings.cpp on the 26.8 tree passes.

@robot-ch-test-poll
robot-ch-test-poll merged commit 0643c4e into backport/26.8/131636 Nov 22, 2026
2 checks passed
@robot-ch-test-poll
robot-ch-test-poll deleted the cherrypick/26.8/131636 branch November 22, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants