Repository navigation
CLI client: some XML defaults - #110607
Conversation
|
Workflow [PR], commit [0ac0575] Summary: ✅
AI ReviewSummaryThe PR extends Missing context / blind spots
Final Verdict
|
|
I used |
…ght 0 CLICKHOUSE_CLIENT_EXPECT_OPT always contains `--highlight 0`, which broke all four cases of the test: - cases 1/2 failed outright with "Bad arguments: option '--highlight' cannot be specified more than once" when adding `--highlight=1`; - case 1 would otherwise disable highlighting via the explicit CLI flag instead of the `<highlight>false</highlight>` config under test; - cases 3/4 never showed inline hints regardless of `<hints>`, because `ReplxxLineReader` gates the hint callback on the highlighter, which `--highlight 0` removes. Strip `--highlight 0` from the spawned client options in all four cases, the same way case 3 already stripped `--disable_suggestion`. Verified locally: the test passes with the `!defaulted()` fix in `ClientBase::addOptionsToTheClientConfiguration` and fails when that fix is reverted, so it now really guards the regression. CI failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110607&sha=f5647cab6dac12d0a4ed2e018601ca4413f7b6ca&name_0=PR&name_1=Fast%20test PR: ClickHouse#110607 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Thank you for a quick reaction I've added tests and the PR now looks kind of ready to me As per the latest bot suggestion, I'm not convinced this PR is the right place to change and test any other options that lack 'defaulted' – it sounds like something for another PR |
The test used a fixed `--query-id test-query-123`, but the flaky check runs the same test concurrently, so parallel runs collided with `QUERY_WITH_SAME_ID_IS_ALREADY_RUNNING` (surfacing as unexpected stderr and a FAIL). Derive the query id from `$CLICKHOUSE_DATABASE` so it is unique per run, and normalise it back to a stable value in the output for the reference. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110607&sha=23b40e8ebceb0f0879923db7c2f0fbf52267cef4&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20flaky%20check%29 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address the AI review on PR ClickHouse#110607: the `!defaulted()` guard was applied only to `--highlight` / `--hints`, but the same precedence bug affected other default-valued client options in `ClientBase::addOptionsToTheClientConfiguration`. Because a `default_value(...)` option always satisfies `options.contains(...)`, the CLI default was unconditionally materialised into the configuration layer and silently overrode any value coming from the client XML config (or, for `history_max_entries`, from `<connections_credentials>`). Guard `history_max_entries`, `suggestion_limit`, `progress` and `progress-table` with `!defaulted()` too, so an XML-configured value is no longer clobbered by the CLI default. The read sites of `progress` / `progress-table` (`config().getString(..., "default")`) and `history_max_entries` (`getUInt(..., 1000000)`) already supply the default, so skipping the write is safe. The `suggestion_limit` read sites did not, so add the documented default `10000` as a fallback at every read (`Client::connect` and `ClientBase::runInteractive`); otherwise the client threw `Not found: suggestion_limit` once the default was no longer written. Add `04614_client_history_max_entries_config` as the focused config-file regression test the review asked for: with `<history_max_entries>1</...>` in the config only the most recent query is kept in the history file, which fails if the CLI default (1000000) still won. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The CLI default `true` of `--enable-progress-table-toggle` was written into the configuration unconditionally, clobbering a value from the client XML before `initTTYBuffer` reads it. Add the same `!defaulted()` guard as for the sibling options, supply the default at the read site, and accept `<enable_progress_table_toggle>` as the underscore-style tag, consistently with the `echo_*` options. Co-Authored-By: Claude Fable 5 <[email protected]>
With the toggle disabled from the XML config (both the dashed key and the underscore-style alias), the client must print the final progress table after each interactive query; with an explicit `--enable-progress-table-toggle=1` on the CLI the flag must win over the config and no final progress table may appear. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Great, thank you, that makes sense! By the way echo_formatted/echo_query_id is not a precedent, there is also server_client_version_message with its --no-server-client-version-message counterpart (#87784) or ssh_key_file/ssh_key_passphrase (#87786, pending) |
…chime`
Both options are declared with `default_value(...)`, so `options.contains(...)`
was always true and the CLI defaults unconditionally overwrote
`print-memory-to-stderr` and `chime-threshold-seconds` values loaded from the
client config file. The `chime` default of 5 seconds moves to the read site
(`getUInt64("chime-threshold-seconds", 5)`) so that omitting the flag keeps
the current default without clobbering the config.
Addresses the AI review on ClickHouse#110607
Co-Authored-By: Claude Fable 5 <[email protected]>
…w keys `04622_client_memory_usage_config` checks that `<print-memory-to-stderr>` from the client config file takes effect and that an explicit `--memory-usage` on the command line overrides it. Also mention `print-memory-to-stderr` and `chime-threshold-seconds` in the sample clickhouse-client.xml. Co-Authored-By: Claude Fable 5 <[email protected]>
`--profile-events-delay-ms` is declared with `default_value(...)`, so `options.contains(...)` stayed true even when the flag was omitted and the CLI default (0) was materialized into the configuration layer, silently overriding an XML `<profile-events-delay-ms>` value. On top of that, `ClientApplicationBase::processOptions` initialized `profile_events.delay_ms` from `options[...]`, so the config layer was never consulted at runtime. Guard the write with `!options[...].defaulted()` and read the value from the client configuration at the use site in `ClientBase::onProfileEvents` (the client config file is loaded after the command line options are processed, so an early read would miss it), with the previous default 0 as the fallback. Add `04623_client_profile_events_delay_config` covering both directions of the precedence and mention the key in the sample clickhouse-client.xml. Addresses the AI review finding in ClickHouse#110607
|
👍 |
In the flaky check, one run out of 50 timed out: the live progress table rendering stalled on a loaded machine and the prompt did not return within the 60-second expect timeout, although the "Event name" header under test had already appeared. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110607&sha=83b8c6fbd04a97097226f30ed5eebf75a18523ef&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29 Related: ClickHouse#110607 Reduce the exposure: a 120-column terminal drops the wide documentation column from every redrawn frame, `numbers(100000)` shortens the query, and the expect timeout is doubled to 120 seconds. Co-Authored-By: Claude Fable 5 <[email protected]>
… their read sites `validateClientConfiguration` checked all four numeric keys with `getUInt64`, but `history_max_entries` is consumed via `getUInt` and `suggestion_limit` via `getInt`, so an out-of-range value such as `5000000000` passed the validator and still threw later from the narrower read. Validate each key with the same parser as its consumer and add boundary regression cases to `04629_client_config_numeric_validation`. Also de-flake the empty `<print-profile-events/>` case of that test: under load the server can deliver profile events in several packets, splitting the `SelectedRows` increment across multiple lines, so check that the counter is printed at all instead of expecting a single exact aggregated line. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110607&sha=8533d1bba003f8bf2a7a207ed25d04b4d02bce48&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29
|
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110607&sha=8533d1bba003f8bf2a7a207ed25d04b4d02bce48&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. Specifically the |
|
@alexey-milovidov Investigated. This is the The #111055 (merged 2026-07-23 17:29 UTC) fixed the stress-restart variant by detaching the table permanently. It does NOT eliminate the Upgrade check variant: at least 3 runs whose branch already contains #111055 still fail with the identical error, e.g. PR 96130 @ 0aa6569, 2026-07-24 10:37 UTC: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96130&sha=0aa6569f3e6563c982227857effd5d2d19c97527&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 . 0 occurrences on master in the last 10 days. Both failures you cited predate #111055, but since #111055 does not cover the Upgrade path, merging master will not reliably clear it. This variant is untracked, as you suspected. I am preparing a fix in a separate PR and will link it here. |
|
Fix PR: #111772 Root cause is not this PR (confirmed): the Upgrade check configures the server object-storage-default ( #111772 forwards |
…tBool The changelog advertises self-closing forms such as <hints/>, <highlight/>, <echo/>, <echo_query_id/> and <echo_formatted/>, but raw Poco boolean parsing throws `Syntax error: Cannot convert to boolean` on an empty value, so only <print-profile-events/> (explicitly normalized) actually worked. Route the underscore remaps in `Client::initialize` and the effective boolean reads (`ClientBase::setupEchoAndHighlightSettings`, the `highlight`/`hints` reads in `ClientBase::runInteractive`, and `enable_highlight` in `Client` and `ClientEmbedded`) through `ConfigHelper::getBool`, which treats the empty tag as `true`. Add `04642_client_empty_boolean_config_tags` covering every advertised empty-tag boolean (the old binary fails all of its cases).
…ocal The remap of the underscore XML spellings (`<echo_query_id/>`, `<echo_formatted/>`, `<enable_progress_table_toggle/>`) to the dashed keys the read sites use lived only in `Client::initialize`, so `clickhouse-local --config-file` silently ignored them even though the equivalent CLI flags worked. Move the remap into `ClientBase::remapClientConfigurationAliases` and call it from both entry points, with a focused `clickhouse-local` regression test.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 142/150 (94.67%) · Uncovered code |
…ght 0 CLICKHOUSE_CLIENT_EXPECT_OPT always contains `--highlight 0`, which broke all four cases of the test: - cases 1/2 failed outright with "Bad arguments: option '--highlight' cannot be specified more than once" when adding `--highlight=1`; - case 1 would otherwise disable highlighting via the explicit CLI flag instead of the `<highlight>false</highlight>` config under test; - cases 3/4 never showed inline hints regardless of `<hints>`, because `ReplxxLineReader` gates the hint callback on the highlighter, which `--highlight 0` removes. Strip `--highlight 0` from the spawned client options in all four cases, the same way case 3 already stripped `--disable_suggestion`. Verified locally: the test passes with the `!defaulted()` fix in `ClientBase::addOptionsToTheClientConfiguration` and fails when that fix is reverted, so it now really guards the regression. CI failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110607&sha=f5647cab6dac12d0a4ed2e018601ca4413f7b6ca&name_0=PR&name_1=Fast%20test PR: ClickHouse#110607 Co-Authored-By: Claude Fable 5 <[email protected]>
Address the AI review on PR ClickHouse#110607: the `!defaulted()` guard was applied only to `--highlight` / `--hints`, but the same precedence bug affected other default-valued client options in `ClientBase::addOptionsToTheClientConfiguration`. Because a `default_value(...)` option always satisfies `options.contains(...)`, the CLI default was unconditionally materialised into the configuration layer and silently overrode any value coming from the client XML config (or, for `history_max_entries`, from `<connections_credentials>`). Guard `history_max_entries`, `suggestion_limit`, `progress` and `progress-table` with `!defaulted()` too, so an XML-configured value is no longer clobbered by the CLI default. The read sites of `progress` / `progress-table` (`config().getString(..., "default")`) and `history_max_entries` (`getUInt(..., 1000000)`) already supply the default, so skipping the write is safe. The `suggestion_limit` read sites did not, so add the documented default `10000` as a fallback at every read (`Client::connect` and `ClientBase::runInteractive`); otherwise the client threw `Not found: suggestion_limit` once the default was no longer written. Add `04614_client_history_max_entries_config` as the focused config-file regression test the review asked for: with `<history_max_entries>1</...>` in the config only the most recent query is kept in the history file, which fails if the CLI default (1000000) still won. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…chime`
Both options are declared with `default_value(...)`, so `options.contains(...)`
was always true and the CLI defaults unconditionally overwrote
`print-memory-to-stderr` and `chime-threshold-seconds` values loaded from the
client config file. The `chime` default of 5 seconds moves to the read site
(`getUInt64("chime-threshold-seconds", 5)`) so that omitting the flag keeps
the current default without clobbering the config.
Addresses the AI review on ClickHouse#110607
Co-Authored-By: Claude Fable 5 <[email protected]>
`--profile-events-delay-ms` is declared with `default_value(...)`, so `options.contains(...)` stayed true even when the flag was omitted and the CLI default (0) was materialized into the configuration layer, silently overriding an XML `<profile-events-delay-ms>` value. On top of that, `ClientApplicationBase::processOptions` initialized `profile_events.delay_ms` from `options[...]`, so the config layer was never consulted at runtime. Guard the write with `!options[...].defaulted()` and read the value from the client configuration at the use site in `ClientBase::onProfileEvents` (the client config file is loaded after the command line options are processed, so an early read would miss it), with the previous default 0 as the fallback. Add `04623_client_profile_events_delay_config` covering both directions of the precedence and mention the key in the sample clickhouse-client.xml. Addresses the AI review finding in ClickHouse#110607
In the flaky check, one run out of 50 timed out: the live progress table rendering stalled on a loaded machine and the prompt did not return within the 60-second expect timeout, although the "Event name" header under test had already appeared. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110607&sha=83b8c6fbd04a97097226f30ed5eebf75a18523ef&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29 Related: ClickHouse#110607 Reduce the exposure: a 120-column terminal drops the wide documentation column from every redrawn frame, `numbers(100000)` shortens the query, and the expect timeout is doubled to 120 seconds. Co-Authored-By: Claude Fable 5 <[email protected]>
The AI review asked for a focused `--config` + pty case guarding the `!defaulted()` fix for `--chime` in `ClientBase::addOptionsToTheClientConfiguration`: without it, the CLI default of 5 seconds silently overwrites `<chime-threshold-seconds>` loaded from the client config file. `04625_client_chime_config` checks that a 1-second threshold from the config makes a 1.5-second query chime when no `--chime` flag is given, and that an explicit `--chime 0` still wins over the config. Related: ClickHouse#110607 Co-Authored-By: Claude Fable 5 <[email protected]>
…faults CLI client: some XML defaults
Changelog category
Changelog entry
Make some commonly-used
clickhouse-clientarguments XML configurable for convenience (<hints/><highlight/><echo/><echo_query_id/><echo_formatted/><print-profile-events/>), and preserve values from the client config file when the corresponding defaulted CLI flags are omitted for settings such ashistory_max_entries,suggestion_limit,progress,progress-table,enable_progress_table_toggle,print-memory-to-stderr,chime-threshold-seconds, andprofile-events-delay-ms.Version info
26.8.1.145(included in26.8and later)