Repository navigation
Skip a setting value from the server's Hello that this version rejects instead of failing the connection - #131636
Conversation
Since ClickHouse#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 ClickHouse#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` (ClickHouse#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 ClickHouse#131506 Related ClickHouse#131269, ClickHouse#131194 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 4 findings over 3 rounds) plus my own cold reviews (6 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-11:20261114-143300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261114-115200 |
|
Workflow [PR], commit [89f9b5d] Summary: ✅
AI ReviewSummaryPR #131636, reviewed at Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units866 translation units recompiled, 7640 s compile time in total, 866 of them have a recent master baseline. |
|
@groeneai fix conflicts. |
…skip-invalid-values Resolve the conflicts with ClickHouse#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]>
|
Fixed in 89f9b5d by merging master. The conflict was #131099 removing Re-checked on the merged build: the settings gtests pass, and a client connecting to a 26.10.2.103 server whose user has |
alexey-milovidov
left a comment
There was a problem hiding this comment.
Questionable, but ok.
Cherry pick #131636 to 26.10: Skip a setting value from the server's Hello that this version rejects instead of failing the connection
…lo that this version rejects instead of failing the connection
Resolve the conflicts of the cherry-pick of #131636. 26.9 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. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
Cherry pick #131636 to 26.8: Skip a setting value from the server's Hello that this version rejects instead of failing the connection
…o that this version rejects instead of failing the connection
Cherry pick #131636 to 26.9: Skip a setting value from the server's Hello that this version rejects instead of failing the connection
…o that this version rejects instead of failing the connection
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]>
Cherry pick #131636 to 26.3: Skip a setting value from the server's Hello that this version rejects instead of failing the connection
…o that this version rejects instead of failing the connection
Backport #131636 to 26.10: Skip a setting value from the server's Hello that this version rejects instead of failing the connection
Backport #131636 to 26.9: Skip a setting value from the server's Hello that this version rejects instead of failing the connection
Backport #131636 to 26.8: Skip a setting value from the server's Hello that this version rejects instead of failing the connection
Closes: #131506
Related: #131269
Related: #131194
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed connecting over the native protocol (
clickhouse-client,remote,Distributedwithout an interserversecret) to an older server whose settings profile has a negative or overflowing value of aSecondssetting, for examplemax_execution_time = -1: the connection failed withA setting's value in seconds cannot be negative. Such a value sent by the server is now skipped with a warning.Description
With #131269 (master, and the
26.10branch since #131472),clickhouse-clientor aremote()/Distributedquery cannot connect to an older server whose user or profile hasmax_execution_time = -1(or the obsoletedrain_timeout = -1):Code: 36 ... cannot be negative. Got -1. (BAD_ARGUMENTS)at the handshake.--apply_settings_from_server=0does not help, and a-1in the server'sdefaultprofile breaks every user. Clusters with an interserversecretare not affected.Connection::receiveHelloreads the settings the server sends with the same strictBaseSettings::readthe server uses for a client's query settings. There an unknown non-important setting was already only a warning, but a known one with a value this version rejects aborted the whole handshake.BaseSettings::readgets an opt-inskip_invalid_values: a non-important setting whose value is rejected (BAD_ARGUMENTSor a parse error, theisParseErrorclassification) is reset to its default and logged; any other exception, and anIMPORTANTsetting, still fails. OnlyreceiveHelloopts in, so the server keeps rejecting-1from a client (#131194). These settings are advisory for the client: the old server still applies its own profile.clickhouse-clientprints the warning on stderr, like the existing unknown-setting warning.Tests: a gtest for the read, and a
test_backward_compatibilitycase that fails without the change. Locally against 26.10.2.103: client,remote()andcluster()connect; the server still rejects-1from a client.The alternative is reverting #131269, which re-opens #131194. This should follow #131269 into
26.10(#131472) and the open 26.3/26.8/26.9 cherry-picks (#131469, #131470, #131471).Workflow [PR]
Sync PR [sync-upstream/pr/131636]
Version info
26.11.1.2402-master(included in26.11and later)26.10.11.6,26.9.37.3,26.8.45.3