Skip to content

Make sync_request_timeout configurable - #94730

Open
c-end wants to merge 15 commits into
ClickHouse:masterfrom
c-end:sync_request_timeout
Open

c-end wants to merge 15 commits into
ClickHouse:masterfrom
c-end:sync_request_timeout

Conversation

@c-end

@c-end c-end commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

While working on #94726, I noticed that there is no setting for the sync request timeout. I found #34597, and the reasoning for not increasing the timeout given in #34597 (comment) makes sense to me. However, I do think that reducing the timeout to aggressively fail fast in large clusters can be valuable. That's why I'm proposing to add a setting with this PR.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Server-side synchronous request-result protocol calls (such as Ping and TableStatus) can now be tuned with sync_request_timeout, while clickhouse-client continues to use its client configuration for its own sync requests.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Workflow [PR]
Sync PR [sync-upstream/pr/94730]

@scanhex12 scanhex12 added the can be tested Allows running workflows for external contributors label Jan 21, 2026
@scanhex12 scanhex12 self-assigned this Jan 21, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f8218c0]

Summary: ✅


AI Review

Summary

This PR makes sync_request_timeout a regular server-side setting for remote TCP work and teaches clickhouse-client to parse fractional sync_request_timeout values from its own configuration. I found one remaining contract violation: the split between the server-side setting and the client-local timeout is incomplete, because the generic CLI carrier still feeds both.

Findings

❌ Blockers

  • [programs/client/Client.cpp:365] The new skip only covers the config-file path. clickhouse-client --sync_request_timeout=... still goes through cmd_settings, is copied back into config() by addToClientOptions, and is then reread into ConnectionParameters, so the same CLI setting lowers the client's own Ping/reconnect timeout as well as the server-side sync_request_timeout. That reintroduces the temporary-table / session-settings loss hazard this PR is explicitly trying to avoid for clickhouse-client.
    Suggested fix: keep the generic --sync_request_timeout carrier server-side only too (for example by filtering it out when settings options are copied into config()), or split the client-local timeout onto a separate explicit option/carrier.
Final Verdict
  • Status: ❌ Block
  • Minimum required actions: stop --sync_request_timeout from feeding the client-local ConnectionParameters timeout, and add a focused regression test for the CLI carrier so it cannot silently couple the client Ping timeout back to the server setting path.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jan 21, 2026
@c-end

c-end commented Jan 26, 2026

Copy link
Copy Markdown
Contributor Author

@scanhex12 the test failures look unrelated to me, but please let me know if there's something I should look into. Otherwise, do you think it's good to be merged?

@c-end
c-end force-pushed the sync_request_timeout branch 2 times, most recently from 6cd3a86 to edd81ac Compare January 29, 2026 09:15
@c-end
c-end force-pushed the sync_request_timeout branch from edd81ac to 6b2dfc7 Compare February 4, 2026 14:42
@c-end

c-end commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

@scanhex12 I just rebased to resolve the conflict in SettingsChangesHistory.cpp. Would be great if this can be merged before someone adds another setting 😄

@c-end

c-end commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

@scanhex12 Could you maybe take this over and get it merged? I'm also happy to rebase again but it's hard to keep up with so many changes in settings

@clickhouse-gh

clickhouse-gh Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@clickhouse-gh clickhouse-gh Bot assigned scanhex12 and unassigned scanhex12 Jun 1, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@abashkeev abashkeev added the comp-settings Settings & configuration infrastructure (server/user/query settings, profiles). label Sep 3, 2026
Comment thread src/IO/ConnectionTimeouts.cpp Resolved
Comment thread src/Client/ClientBase.cpp Resolved
@clickhouse-gh clickhouse-gh Bot added comp-cli clickhouse-client (interactive CLI) and client library. and removed comp-settings Settings & configuration infrastructure (server/user/query settings, profiles). labels Sep 10, 2026
Comment thread src/Client/ClientBase.cpp Resolved
Comment thread src/Client/ConnectionParameters.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing f8218c045 with master cf6e20631 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

10 translation units recompiled, 29 s compile time in total, 10 of them have a recent master baseline.

Job report

Comment thread src/Client/ClientBase.cpp Resolved
Comment thread src/Core/Settings.cpp Resolved
@clickhouse-gh clickhouse-gh Bot added comp-settings Settings & configuration infrastructure (server/user/query settings, profiles). and removed comp-cli clickhouse-client (interactive CLI) and client library. labels Sep 14, 2026
@c-end

c-end commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

@scanhex12 could you take another look at this? The AI reviewer seems happy and the test failures look unrelated to me.

middas-0706 pushed a commit to middas-0706/ClickHouse that referenced this pull request Sep 19, 2026
…check

The `Error message in clickhouse-server.log` sub-result of `Upgrade check
(amd_release)` fails on unrelated PRs because the post-upgrade server logs

  <Error> StorageKeeperMap (test_1.`05024_keeper_map_parenthesized_metadata_unparsable`
  (...)): Failed to activate table because of invalid metadata in ZooKeeper.
  Please DROP/DETACH table

for a table that `05024_keeper_map_parenthesized_metadata` deliberately left
with an unreadable `metadata` znode.

The job replays the previous release's suite under `stress --upgrade-check`.
The test rewrites its shared `metadata` znode through shapes a server must
refuse and reverts them near the end of the file; stress worker 1
(`--database=test_1`) runs with `memory_tracker_fault_probability`, so an
injected `Code: 241` can stop the file before the `DROP`s at its end run,
leaving the tables it created behind with an unreadable znode. The upgrade
restart re-attaches the surviving tables and logs the message above per table
instead of refusing to start, which is what ClickHouse#115941 made it do on purpose (it
replaced the startup abort of ClickHouse#115881), and the runner greps the post-upgrade
log for `<Error>`.

Measured on the three PRs the signature has hit (ClickHouse#94105, ClickHouse#118419, ClickHouse#94730): the
fixture accounts for 1/1, 1/1 and 3/3 of the leaked lines while every other
sub-result of the job is OK, so the check yields no signal at all for the
carrier.

The entry requires the `StorageKeeperMap` logger AND a backquoted table name
starting with the fixture prefix AND the message, so the same message on any
other KeeperMap table, which is the shape a real metadata-compatibility
regression takes, still fails the job. Replaying the job's own scan pipeline
over each carrier's `clickhouse-server.upgrade.log` reproduces that job's
`upgrade_error_messages.txt` byte for byte, and the entry takes each of the
three to zero; over the 156,750 pre-filter log lines the pattern matches
exactly the leaked lines and nothing else.

Related: ClickHouse#115881
Resolve the conflict with the move of the settings changes history into the setting declarations
(ee6b44f): the history records this PR added to `SettingsChangesHistory.cpp` now live as
trailing arguments of the `DECLARE` of each setting.

- retargeted PR record [email protected] to 26.10 (settings-history check rule)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@c-end

c-end commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

@alexey-milovidov thanks for updating the branch. Can we get this merged before the version becomes out-of-date again?

{
String name{setting};
/// The `sync_request_timeout` config key controls only synchronous requests made by `clickhouse-client`.
if (name == "sync_request_timeout")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only blocks the config-file carrier from reaching client_context. A regular CLI setting still reaches both surfaces: processOptions copies every settings option into config() via addToClientOptions (programs/client/Client.cpp:1318-1320), and ConnectionParameters(config(), ...) later reads sync_request_timeout back out of that config (programs/client/Client.cpp:625, src/Client/ConnectionParameters.cpp:398-412). So clickhouse-client --sync_request_timeout=0.5 ... still lowers the client's own Ping/reconnect timeout while also sending the setting to the server.

That reintroduces the session-loss hazard this PR is trying to avoid: a user who only wanted server-side TablesStatusRequest to fail fast can still reconnect away temporary tables or session settings after an error. Please keep the generic --sync_request_timeout carrier server-side only as well, for example by filtering it out when settings options are copied into config(), or by giving the client-local timeout a separate explicit option.

@maxknv maxknv added the external Author is not a member of the ClickHouse organization label Nov 2, 2026
@clickhouse-gh clickhouse-gh Bot added comp-networking The connection layer under the protocols, on the server and on the client side: socket read / wri... and removed comp-settings Settings & configuration infrastructure (server/user/query settings, profiles). labels Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-networking The connection layer under the protocols, on the server and on the client side: socket read / wri... external Author is not a member of the ClickHouse organization pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants