Repository navigation
Cherry pick #131636 to 26.3: Skip a setting value from the server's Hello that this version rejects instead of failing the connection - #132959
Conversation
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
|
This cherry-pick would not fix 26.3, so I did not resolve it. On 26.3 Measured against a 25.3 server whose user has
So this PR can be closed. The 26.3 client failure comes from the 26.3 backport of #131269 (#131779; the 26.3.63.123 client works against the same server) and would need a different change on 26.3. |
Conflicts in `src/Client/Connection.cpp`, `src/Core/BaseSettings.h`, `src/Core/Settings.cpp`, `src/Core/Settings.h` and `src/Core/tests/gtest_settings.cpp` are resolved by taking the 26.3 side and re-applying the change of #131636 on top of the 26.3 API (`read(in, format, skip_invalid_values)`, `isParseError` from `Processors/Formats/IRowInputFormat.h`). Adaptation for 26.3: here `SettingFieldSeconds::parseFromString` does not validate the value (#112757 is not on 26.3), so reading `max_execution_time = -1` from the server's `Hello` succeeds and the client fails later, when it applies the value as a `Field`. With `skip_invalid_values`, `BaseSettings::read` now also re-assigns the parsed value as a `Field`, so such a value is skipped with a warning, as on master. The strict read (the server side) is unchanged. The gtest is adapted accordingly; master-only gtests are not carried over. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🕵 @groeneai, your analysis is right: on 26.3
Verification here is limited to |
|
I re-ran the measurement at
One problem with #133563: the new case in |
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-picklocally.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:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job