Commit Graph
788 Commits
Author SHA1 Message Date
Alexey Milovidov 44fc666132 Merge remote-tracking branch 'origin/master' into inline-insert-data 2026-03-31 10:16:14 +00:00
Alexey MilovidovandClaude Opus 4.6 f95ec2e1c2 Add setting send_table_structure_on_insert_with_inline_data and --inline-insert-data client option
Processing many small inserts over the native protocol is suboptimal because
the server replies with the table structure and column defaults for every query.

This adds:
- A setting `send_table_structure_on_insert_with_inline_data` (default true). When disabled,
  the server will parse inline data in INSERT queries itself instead of sending
  table structure back to the client.
- A `--inline-insert-data` command-line option for `clickhouse-client`. When set,
  the client sends the data as is in the INSERT query text instead of converting
  it to blocks in the native format, and routes the query through the ordinary
  query path (no round-trip for table structure).

The server already has the machinery to process inline INSERT data (used by the
HTTP interface and async inserts). This change reuses it for the native protocol.

https://github.com/ClickHouse/ClickHouse/issues/91630

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-28 20:54:46 +01:00
Raúl Marín 818dc81eb7 Revert "Merge pull request #100228 from ClickHouse/revert-95127"
This reverts commit c4a081c1d5, reversing
changes made to e12cd5d0f9.
2026-03-25 16:33:05 +01:00
serxaandClaude Opus 4.6 c28322674a Add trace logging to Throttler and fix flaky test 02844_max_backup_bandwidth_s3
Add named `Throttler` instances with LOG_TRACE logging to diagnose
throttling issues (follow-up to #95127). The `Throttler` class now
takes a `std::string_view` name as its first constructor parameter.

Logging covers all state mutations:
- Sleeping: amount, count, tokens, max_speed, block_ns, max_block_ns, sleep_ns
- Not sleeping (when throttler is active): amount, count, tokens, max_speed
- `reset`: count, tokens, max_burst before clearing
- `setMaxSpeed`: old/new speed, tokens

Fix the flaky test by removing the `native_copy` case — with
`allow_s3_native_copy=1` S3 performs a server-side copy and ClickHouse
never reads/writes the data, so throttling cannot apply and wall clock
time is unpredictable.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=95118&sha=ab1adaa5d88f38a4934fac9fc8ffb91e97ef5a6f&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-20 18:14:35 +00:00
Raúl MarínandClaude Opus 4.6 6aa187da03 Reduce CurrentThread.h include fan-out to cut compilation cascade
- Remove `CurrentThread.h` from high-fan-out headers: `ProcessList.h`,
  `IQueryPlanStep.h`, `DDLWorker.h`, `TCPHandler.h`, `AggregatingTransform.h`,
  `ParallelParsingInputFormat.h`, `StorageTableFunction.h`, `parseSyslogLevel.h`,
  `EmbeddedRocksDBBulkSink.h`, `BlockIO.h`, `LocalConnection.h`,
  `StorageMaterializedView.h`, `HTTPHandler.h`
- Extract `QueryScope` from `CurrentThread` into standalone `Common/QueryScope.h`
  with its own `.cpp`, replacing the nested `CurrentThread::QueryScope` class
- Extract `getCurrentThreadGroup` free function into `Common/ThreadGroupSwitcher.h`,
  replacing `CurrentThread::getGroup()` in template headers:
  `threadPoolCallbackRunner.h`, `ParallelFormattingOutputFormat.h`,
  `HashedDictionaryParallelLoader.h`, `UniqExactSet.h`, `HashedDictionary.h`,
  `StatusRequestsPool.h`
- De-inline `MemoryTrackerSwitcher` ctor/dtor into `MemoryTrackerSwitcher.cpp`
- De-inline `ResourceGuard::Request::wait` into `ResourceGuard.cpp`
- De-inline `ManyAggregatedData` destructor into `AggregatingTransform.cpp`
- De-inline `QueryStatus::updateProgressIn/Out` into `ProcessList.cpp`
- Add explicit `CurrentThread.h` includes to `.cpp` files that relied on
  transitive includes through the trimmed headers

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-12 14:54:34 +01:00
Alexey MilovidovandClaude Opus 4.6 6897b4e8a4 Add NOLINT(bugprone-empty-catch) to empty catch blocks with specific types
clang-tidy `bugprone-empty-catch` fires on catch blocks with empty
bodies regardless of the exception type.  Re-add the NOLINT annotation
on the catch lines that were previously suppressed with `catch (...)`
and now use specific exception types.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-02 04:40:52 +00:00
Alexey MilovidovandClaude Opus 4.6 6415834976 Narrow catch (...) to specific exception types where possible
Replace blanket `catch (...)` with specific exception types based on
analysis of what each try block can actually throw:

- `const Exception &` for catch blocks where only ClickHouse operations
  are involved (Field operations, expression evaluation, parsing, etc.)
- `const std::exception &` for catch blocks involving standard library,
  Poco, or third-party code (filesystem, HTTP, thread creation, etc.)

Blocks that genuinely need `catch (...)` are left unchanged:
- try-pattern functions (`tryGetPosition`, `tryDeserializeText`, etc.)
- Exception formatting utilities in `Exception.cpp`
- Signal/terminate handlers
- FFI callbacks (DeltaLake)
- Dual-handler patterns (already have specific + catch-all)
- `noexcept` functions with user-supplied callbacks

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-02 03:55:15 +00:00
Alexey MilovidovandClaude Opus 4.6 b60662ea1c Annotate all catch (...) blocks flagged by the style check
Enhance the `catch_all` style check in two ways:

1. Recognize more legitimate exception-handling patterns as "handled":
   `getCurrentExceptionMessage`, `getCurrentExceptionCode`,
   `getCurrentExceptionMessageAndPattern`, `ExecutionStatus::fromCurrentException`,
   `onBackgroundException`, `storeException`, `STDERR_FILENO`, `writeRetry`,
   `handle_exception`, `handleException`, `finishWithException`.

2. Fix function-try-block detection for destructors like
   `Exception::~Exception() try { } catch (...) { }` — the enclosing-scope
   scan now falls through to the function-try-block scan when it hits a
   namespace/class scope (no parentheses in signature).

For the remaining 108 catch-all blocks, add `// Ok: <reason>` comments
explaining why each is intentional. Categories include:

- Try-patterns (`tryDeserializeText`, `tryGetPosition`, etc.)
- Exception handling/reporting utilities (`Exception.cpp`)
- Non-essential system probes (`Server.cpp` Linux /proc and /sys checks)
- C callbacks where exceptions cannot propagate (zip archives)
- Background thread exception saving (`onBackgroundException`)
- Fallback/retry logic (`DatabaseOverlay`, `ReadSchemaUtils`)
- Best-effort cleanup or error reporting
- Tests that expect exceptions

Replace `// NOLINT(bugprone-empty-catch)` with `// Ok:` comments on all
catch blocks that were flagged by the new check. Fix Allman-style brace
violations in `convertFieldToType.cpp` and `ClientBase.cpp`.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-02 03:06:11 +00:00
Alexey MilovidovandGitHub e8654c51eb Revert "Improve help output for ClickHouse applications" 2026-02-26 07:51:17 +01:00
Vitaly BaranovandGitHub 14b4f8f12c Merge pull request #96841 from vitlibar/fix-client-exit-status-after-server-error
Fix exit status of clickhouse-client after server error
2026-02-16 09:49:45 +00:00
Alexey MilovidovandClaude Opus 4.6 01363ea4f4 Merge master into ssh-twice branch to resolve conflicts
Adapted the `ssh-key-file` check to the new retry loop structure:
added `!config().has("ssh-key-file")` to the `should_ask_password` condition.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-15 19:58:45 +01:00
Vitaly Baranov 52f182e5df Fix exit status of clickhouse-client after server error. 2026-02-15 19:44:33 +01:00
Alexey MilovidovandGitHub eebc7db1bb Merge pull request #96197 from AVMusorin/add-missed-client-option
Add missed `--external` argument in client help message
2026-02-07 07:58:53 +01:00
Aleksandr Musorin 9bf31f1961 Add external argument in client help message 2026-02-06 14:42:33 +01:00
Alexey MilovidovandClaude Opus 4.6 f31adb4a49 Fix CI failures: wrap long help text lines and fix git-import --help abort
- Wrap long lines in `getHelpHeader` and `getHelpFooter` for `clickhouse client`
  and `clickhouse local` to keep lines within reasonable width,
  fixing the 00910_client_window_size_detection test
- Use `createOptionsDescription` instead of raw `po::options_description` constructor
  in `git-import` and `static-files-disk-uploader` to handle zero terminal width
  properly, fixing the `git-import --help` abort in debug builds
  (03823_clickhouse_help_return_codes test)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-05 22:21:04 +01:00
Alexey MilovidovandClaude Opus 4.5 62ccfbd3aa Improve help output for ClickHouse applications
This commit improves the help output for all ClickHouse applications:

- Add `clickhouse help` command that lists all available subcommands
- Return exit code 0 for all help messages (previously some returned 1)
- Output help messages to stdout instead of stderr
- Use "clickhouse <cmd>" format instead of argv[0] in help messages
- Add dynamic `app_name` detection for `clickhouse client` and `clickhouse local`
  to show correct invocation name based on how the binary was called
- Add `--no-sudo` option for `clickhouse start` and `clickhouse restart`
  for environments without sudo (e.g., Docker containers)
- Add detailed help headers and footers for client and local with usage examples

Closes #58244

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-02-05 07:12:44 +01:00
vdimir 312fa82006 Merge branch 'master' into vdimir/totp 2026-01-29 13:29:20 +00:00
vdimir ddcf7b97cd Add client option --one-time-password 2026-01-29 10:31:46 +00:00
Isak Ellmer 89f5c1d81e Don't try to authenticate twice when using ssh 2026-01-28 12:17:31 +01:00
vdimir c735499cd4 Update password promt retry in client/Client.cpp, fix clang-tidy 2026-01-28 11:07:49 +00:00
vdimir cd54631479 Rename AUTHENTICATION_FAILED_SECOND_FACTOR -> REQUIRED_SECOND_FACTOR 2026-01-27 17:18:21 +00:00
vdimir c42eb803e6 totp as second factor 2026-01-27 16:49:38 +00:00
Sema Checherinda 7dfe727452 quorum with async inserts 2026-01-23 16:39:23 +01:00
Raúl MarínandGitHub a6597b3294 Revert "Don't try to authenticate twice when using ssh" 2026-01-20 21:05:38 +01:00
Isak EllmerandAlexey Milovidov 5eab9e5d24 Don't try to authenticate twice when using ssh 2026-01-19 20:15:39 +01:00
Bharat Nallan Chakravarthy ae119119a6 Merge 'master' into client-warnings-xml-option 2026-01-17 11:59:26 +05:30
Krishna Mannem e99c7f8e11 skip cloud endpoint autologin stuff if uri contains user/pass 2026-01-12 16:17:48 -05:00
Bharat Nallan Chakravarthy 0764b531ae Merge 'master' into client-warnings-xml-option 2026-01-06 06:59:30 +05:30
Krishna Mannem e0481761a5 do not use oauth login when username + password is in connection string 2026-01-05 16:55:01 -05:00
Cole Smith e7f9d16029 require spaces on both sides
nit
2025-12-29 20:49:07 -05:00
Cole Smith c31dec09f9 allow spaces around equal sign
add tests

nit
2025-12-29 14:04:06 -05:00
Ladislav Snizek ca76f6e363 Merge branch 'master' into client-warnings-xml-option 2025-12-29 14:09:57 +01:00
Alexey MilovidovandGitHub d7740f3bd6 Merge branch 'master' into tls-sni 2025-12-25 17:03:34 +01:00
Alexey Milovidov 61139cdeab Merge branch 'master' into prevent-calling-to-string-on-field 2025-12-17 02:21:06 +01:00
Krishna Mannem 284c8ba0a1 add tests 2025-12-11 12:48:34 -05:00
Krishna Mannem 4249c2f46f respect client configuration 2025-12-11 10:04:58 -05:00
Krishna Mannem 969d9fd8c7 Revert "Revert "Idp login cli support""
This reverts commit 73a81cb3c2.
2025-12-11 10:04:58 -05:00
Alexey Milovidov 0e6a4bbaa7 Prevent implicit conversions to Field when calling toString 2025-12-06 20:48:34 -08:00
Matt Klein 435455d89e client: allow TLS SNI override
When connecting to Clickhouse Cloud (or any similar proxied
setup) over a tunnel it is required to correctly specify SNI
on the TLS connection. This allows overriding SNI if the DNS
is something else.

Signed-off-by: Matt Klein <[email protected]>
2025-11-08 09:32:44 -07:00
Pavel KruglovandGitHub f5eb8467b4 Merge branch 'master' into client-version-message-option 2025-11-05 14:01:48 +01:00
Konstantin Bogdanov 48d2f3b145 Fix readability-container-contains 2025-11-04 23:40:04 +01:00
Azat Khuzhin d9354e135f Fix ~ expansion in history file override
Simply checking for `~/` should be enough, since we do not support
anything except expanding current's user `$HOME` (i.e. we do not support
`~another_user` syntax).
2025-10-29 17:08:54 +01:00
Ladislav Snizek 5015f81b89 Merge branch 'master' into client-warnings-xml-option 2025-10-21 13:39:08 +02:00
Ladislav Snizek 94c368b7a2 Add --no-server-client-version-message and <server_client_version_message/> client option (clean console startup) 2025-10-21 13:17:15 +02:00
Konstantin Bogdanov e747fec21f Fix tidy 2025-10-16 19:33:13 +02:00
Konstantin Bogdanov bb1f1c889c Remove redundant include 2025-10-16 19:33:11 +02:00
Konstantin Bogdanov d87478b7c2 Lint 2025-10-16 19:33:10 +02:00
Konstantin Bogdanov 9b5f4308bb Draft implementation 2025-10-16 19:33:08 +02:00
Alexey Milovidov b75dc907fb Merge with master 2025-10-14 16:17:16 +02:00
Alexey MilovidovandGitHub 889c9d90c6 Merge branch 'master' into revert-83490-revert-82535-compression-logs-profile-events 2025-10-14 16:14:27 +02:00