Commit Graph
1061 Commits
Author SHA1 Message Date
Alexey Milovidov dad1ac0790 Merge remote-tracking branch 'origin/master' into iceberg-read-manifests-on-io-pool 2026-10-23 20:44:09 +00:00
Alexey Milovidov 8e4e99ea15 Merge remote-tracking branch 'origin/master' into iceberg-read-manifests-on-io-pool 2026-10-22 23:52:29 +00:00
George Larionov b22e47141b Merge remote-tracking branch 'origin/master' into ai-functions/ai-service-static-pool 2026-10-22 22:34:02 +00:00
Alexey Milovidov 9ce1640e29 Merge pull request #126638 from davidrz15/epipe_fix
Terminate query quietly on EPIPE signal
2026-10-21 20:14:09 +00:00
Groene AIandClaude Opus 5.5 aff0a33949 Iceberg: read manifest files on the IO thread pool, parse them on the reading threads
A manifest walk over an Iceberg table with many manifests was bounded by
`iceberg_manifest_decode_concurrency`: fetching a manifest (a remote round trip)
and parsing it (CPU, about 2 ms per manifest) were one task on a dedicated pool,
so only that many round trips overlapped (issue #127061: 671 manifests, 9.6 s at
4, 4.0 s at 32).

Manifest files are now read ahead on the IO thread pool, 64 at a time and at most
64 MiB of manifests not in the metadata files cache, and nothing is parsed there.
The read goes through `getOrSetManifestFile` as before, so concurrent queries
still share one read per manifest and `SYSTEM CLEAR ICEBERG METADATA CACHE` keeps
its semantics; the cached cell holds the bytes and parses them on the first
`getDeserializer()` call (`std::call_once`).

The threads that call `IcebergIterator::next` parse the manifests: each one
continues an idle partially read manifest or parses the next one, so parsing
keeps the parallelism of the reading threads; with one reading thread the files
come in the manifests' order as before. Delete manifests are parsed by the
threads that need them, and the last one sorts the deletes. `totalRows` reads
ahead and parses on the calling thread.

Removed: the manifest decode thread pool and its metrics, the producer thread,
the bounded queue and the stop flag of `ManifestFileIterator`,
`ParallelManifestDecode.h`. The query settings `iceberg_manifest_decode_concurrency`
(and its old name `iceberg_delete_manifest_decode_concurrency`) and
`iceberg_file_entries_queue_size`, and the server settings
`max_iceberg_manifest_decode_thread_pool_size`,
`max_iceberg_manifest_decode_thread_pool_free_size` and
`iceberg_manifest_decode_thread_pool_queue_size` are obsolete: accepted and ignored.

The integration tests of the decode concurrency now vary `max_threads` instead;
the test of the removed pool and the timing test of the removed setting are
deleted.

Closes #127061

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 02:07:03 +00:00
George Larionov 1d312f70f9 Merge master into ai-functions/ai-service-static-pool 2026-10-20 16:01:36 +00:00
Konstantin VedernikovandClaude Opus 5.5 2ce250a2f9 Merge remote-tracking branch 'origin/master' into gpu_mem
Resolve conflicts in the `dlopen` guard in `programs/main.cpp` and
`programs/keeper/keeper_main.cpp`: keep the guards identical (as master now
requires) and keep `USE_GPU` from this branch in both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:25:37 +00:00
Alexey MilovidovandClaude Opus 5.5 d011ea7ff1 Stop the client quietly on EPIPE on its own stdout only
The previous approach was unsafe:

- Swallowing `EPIPE` in `WriteBufferFromFileDescriptor::nextImpl` affected every
  pipe, also on the server: data written to a child process that exited early was
  silently dropped, and `UserDefinedExecutableFunctionDriverInvoker` and
  `clickhouse-disks sed`, which catch the `EPIPE` `ErrnoException`, would get a
  `LOGICAL_ERROR` exception from `finalize` of the silently canceled buffer.
- Ignoring `SIGPIPE` in the client was redundant: Poco already blocks it in all
  threads, which is why the write fails with `EPIPE` at all. And an ignored signal
  is inherited through `exec`, while `ShellCommand` resets only the signal mask, so
  the pager and executable UDFs started by `clickhouse-local` would inherit it.

Instead, the console output buffer of the client remembers that its write failed
with `EPIPE`. Then the client does not print the error, does not run further
queries (even with `--ignore-error`), and exits with code 0.

Closes: https://github.com/ClickHouse/ClickHouse/issues/126443

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 03:36:58 +00:00
Alexey Milovidov 45ccaa5442 Merge pull request #120758 from ClickHouse/statistics-cache-per-part
Cache statistics per data part and column instead of per set of parts
2026-10-16 18:25:57 +00:00
Pedro Ferreira 03e16d88f9 Merge pull request #124915 from groeneai/fix-command-line-config-section-without-file-section
Apply configuration sections given only on the command line
2026-10-16 10:19:11 +00:00
Nikolay Degterinsky e444dde4d8 Merge remote-tracking branch 'upstream/master' into sync-forbid-sql-access-entities-targeting-users-config
# Conflicts:
#	src/Access/AccessControl.h
2026-10-15 19:12:38 +00:00
Alexey Milovidov 0acd8e6df3 Merge remote-tracking branch 'origin/master' into HEAD 2026-10-15 12:31:49 +00:00
George LarionovandClaude Opus 5.5 d5a013c36a Merge master into ai-functions/ai-service-static-pool
Conflicts were only in the AI function integration tests: the cancellation
tests from master run alongside this branch's concurrency tests, pinned to one
request per thread.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 23:09:25 +00:00
Konstantin Vedernikov 67c95b442b add CCCL pool pinned memory instead of ours & other comments fix 2026-10-14 12:29:58 +00:00
George Larionov 33e3475f38 Merge remote-tracking branch 'origin/master' into ai-functions/ai-service-static-pool 2026-10-13 20:00:15 +00:00
Raúl MarínandClaude Opus 5.5 1b30fbb7d4 Do not produce profile events in clickhouse-local when nothing reads them
They feed only the progress bar and table, the interactive statistics,
`--print-profile-events` and `--memory-usage`. Producing them loads the time
zone for the sample block, which `SELECT 1` otherwise never needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 19:08:05 +02:00
Konstantin Vedernikov 8559d53803 fix review 2026-10-13 16:49:13 +00:00
Nikolay Degterinsky 0afdec748c Forbid SQL access entities targeting users.xml users 2026-10-09 15:29:09 +00:00
Groene AIandClaude Opus 5.5 9a3fe10e8e Apply configuration sections given only on the command line
`argsToConfig` stores the arguments after `--` as flat keys of a
`MapConfiguration` layer (`merge_tree.max_suspicious_broken_parts` -> `7`).
Such a layer has no key for the parent node, so `has("merge_tree")` was
false on the merged `LayeredConfiguration` while `keys("merge_tree")`
already returned the command-line children. Every reader of the form
`if (!config.has(section)) return; config.keys(section, ...)` therefore
silently dropped a section that existed only on the command line:
`MergeTreeSettings`, `DistributedSettings`, `DatabaseReplicatedSettings`,
Keeper coordination settings, `macros` in clickhouse-local,
`remote_url_allow_hosts`, `http_options_response`, system logs,
`zookeeper`, and `filesystem_caches` (which threw at startup instead).

`LayeredConfiguration::getRaw` now reports a node that has children in
some layer as present with an empty value, after the exact-key lookup
over all layers has failed, so a real value is never shadowed whatever
the layer order. The per-site workaround in `LocalServer` that
materialized `http_options_response` for the same reason is removed.

The ZooKeeper reload on a configuration change is gated on the parsed
file it then reads, so a ZooKeeper section given only on the command
line keeps its startup session instead of failing every later reload.

Closes #124747

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:58:10 +00:00
Alexey MilovidovandClaude Opus 5.5 48d2389afe Merge remote-tracking branch 'origin/master' into statistics-cache-per-part
Conflicts with https://github.com/ClickHouse/ClickHouse/pull/121671 resolved by
keeping its startup/shutdown race fix in `StorageMergeTree` while dropping the
statistics refresh task (`startStatisticsCache`, `stopStatisticsCache`,
`refresh_stats_task_mutex`), which this PR removes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:00:13 +00:00
Raúl Marín 895d8b8288 Merge pull request #123364 from Algunenano/secret-arguments-registry
Declare secret arguments next to each engine instead of in the parser
2026-10-09 03:08:49 +00:00
George Larionov 3cdb573887 Merge remote-tracking branch 'origin/master' into ai-functions/ai-service-static-pool 2026-10-08 22:46:33 +00:00
Alexey MilovidovandClaude Opus 5.5 6bdeb0c0a1 Merge remote-tracking branch 'origin/master' into statistics-cache-per-part
Resolve conflicts in `MergeTreeData.cpp` with #124420: keep the per-part
`StatisticsCache` and the removal of `refreshStatistics`, take master's
removal of `readLockParts` around `loadStatistics` and the new
`LoadedStatistics` profile event. With the cache, `LoadedStatistics`
counts the parts whose statistics are collected for the estimator, from
the cache or from the part, so its description and the test comments are
updated accordingly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:11:46 +00:00
Antonio Andelic 8281447185 Merge pull request #112977 from superdiaodiao/fix-80759-protocol-metrics
Report protocol metrics for servers declared under `<protocols>`
2026-10-08 06:51:30 +00:00
Alexey Milovidov b55d08eac3 Merge remote-tracking branch 'origin/master' into statistics-cache-per-part
Conflicts: master reworked the `startup`/`shutdown` race handling and guarded `refresh_stats_task`
with a mutex; this PR removes the periodic statistics refresh task entirely, so master's
`startup`/`shutdown` structure is kept without `startStatisticsCache`/`stopStatisticsCache`.
2026-10-07 20:41:28 +00:00
Raúl Marín 080a87cf8f Merge remote-tracking branch 'blessed/master' into secret-arguments-registry
# Conflicts:
#	src/Parsers/FunctionSecretArgumentsFinder.h
#	src/Planner/PlannerActionsVisitor.cpp
#	src/Processors/QueryPlan/QueryPlanFormat.cpp
2026-10-07 13:54:18 +00:00
Alexey Milovidov bce2e8e746 Merge remote-tracking branch 'origin/master' into query-cache-on-disk 2026-10-06 07:08:16 +00:00
George LarionovandClaude Opus 5.5 94b38dc25c Merge master into ai-functions/ai-service-static-pool
Conflicts were only in the generated session settings route map and explorer:
master's versions plus `ai_function_max_concurrent_requests_per_thread`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 01:06:25 +00:00
Raúl MarínandClaude Opus 5.5 c7aadb729c Merge blessed/master into secret-arguments-registry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 12:24:39 +02:00
Chester 451114e7b7 Merge branch 'master' into fix-80759-protocol-metrics 2026-10-05 18:10:36 +08:00
Alexey Milovidov 0b6c382eca Merge remote-tracking branch 'origin/master' into statistics-cache-per-part 2026-10-05 03:57:15 +00:00
Azat Khuzhin 07f97f5c82 Merge pull request #115102 from groeneai/fix-local-fatal-report-channel
Keep the crash-report channel of clickhouse-local reachable
2026-10-05 00:24:36 +00:00
Alexey Milovidov 5d166ba598 Merge pull request #114568 from ClickHouse/client-dialect-command
Add `/dialect`, `/lang`, `/language` client commands
2026-10-04 19:41:11 +00:00
Alexey Milovidov 6721cae0db Merge pull request #123862 from groeneai/fix-clickhouse-local-drop-sync-with-path
Fix `DROP ... SYNC` hanging forever in `clickhouse-local` with `--path` when no metadata is loaded
2026-10-04 18:47:09 +00:00
Groene AIandClaude Opus 5.5 d02424d74d Do not let buildLoggers reconfigure the crash report logger of clickhouse-local
`buildLoggers` re-channels every existing logger, including the one the signal
listener reports to, so when neither stdin nor stderr is a terminal a fatal
signal printed nothing, and `--client_logs_file` was not written.

CI example: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108078&sha=a84b136d9ac4980b5ff9457eba8f3dbd3b1d09de&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29
PR: https://github.com/ClickHouse/ClickHouse/pull/108078

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:48:16 +00:00
Groene AIandClaude Opus 5.5 5ec356acf5 Fix DROP ... SYNC hanging in clickhouse-local with --path when no metadata is loaded
`DROP TABLE|VIEW|DATABASE ... SYNC` waits in `DatabaseCatalog::waitTableFinallyDropped`
until the background drop task removes the table. `LocalServer::processConfig` creates and
starts that task in both branches without `--path` (#81705), but the `--path` branch did it
only inside the metadata-loading block, i.e. only when `metadata/` exists and
`--only-system-tables` is not set. With a new directory (released versions) or with
`--only-system-tables` (master, new and existing directory) the task never existed, so the
SYNC drop waited forever. On master the plain new-directory case stopped hanging only as a
side effect of #123124, which writes `metadata/default.sql` before this check.

Start the tasks in the `--path` branch whenever the metadata block did not. The metadata
block itself is unchanged, so `createBackgroundTasks` still runs before `loadMetadata` and
`startupBackgroundTasks` after it. In `--only-system-tables` mode this does not touch the
inspected directory: `cleanup_task` is created only for the server, and clickhouse-local
never calls `loadMarkedAsDroppedTables`, so the drop task only handles drops issued in the
session. The cost is the general schedule pool, which every invocation without `--path`
already creates.

Tests: new 05321 covers `--only-system-tables` with a new and with an existing directory
plus a plain new directory. 04545 asserted that this mode creates no general schedule pool;
clickhouse-local now always creates it, so the test keeps checking only the five lazily
created pools. The rollback comment in `InterpreterCreateQuery` no longer claims that
clickhouse-local never finishes `waitTableFinallyDropped`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:17:15 +00:00
Alexey Milovidov 254f802799 Merge remote-tracking branch 'origin/master' into HEAD 2026-10-04 11:04:04 +00:00
Alexey Milovidov 398f611704 Merge remote-tracking branch 'origin/master' into HEAD
# Conflicts:
#	src/Interpreters/Cache/QueryResultCache.cpp
#	src/Interpreters/Cache/QueryResultCache.h
#	src/Interpreters/executeQuery.cpp
2026-10-04 02:53:20 +00:00
Alexey MilovidovandClaude Opus 5.5 7c72a9fdc9 Address review: zero entry size limits and DROP QUERY CACHE for the query cache on disk
- A maximum entry size of 0 (`query_cache.max_entry_size_in_bytes` or
  `query_cache.max_entry_size_in_rows`) now means "nothing may be cached" for
  both backends, as it always did for the in-memory one. `clickhouse-local`
  no longer overloads these limits to disable the in-memory cache: it
  creates it with a zero size and takes the entry size limits from its
  configuration, so the on-disk cache is usable there.
- `canWriteToQueryResultCacheOnDisk` and `QueryResultCache::canStoreEntries`
  take the row limit into account, so the checks against storing wrong
  results (non-deterministic functions, system tables, overflow modes) agree
  with what the write path actually stores.
- The on-disk entry format (version 5) stores `query_cache_tag`, and
  `SYSTEM DROP QUERY CACHE [TAG 'tag']` also removes the matching on-disk
  entries from the filesystem cache selected by setting
  `query_cache_on_disk_cache_name`, leaving other data of the filesystem
  cache in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:09:52 +00:00
Alexey MilovidovandClaude Opus 5.5 d658e19106 Merge remote-tracking branch 'origin/master' into columns-cache
Conflicts:
- ci/jobs/scripts/docs/autogenerate/test_system_table_pages.py: removed on master, accept the deletion.
- src/Storages/MergeTree/MergeTreeData.cpp: keep includes from both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 16:19:53 +00:00
Alexey Milovidov 7a62f91071 Merge remote-tracking branch 'origin/master' into HEAD
# Conflicts:
#	src/Storages/MergeTree/MergeTreeData.cpp
#	src/Storages/MergeTree/MergeTreeSettings.cpp
#	tests/queries/0_stateless/04516_join_order_estimation_pruned_parts.sql
#	tests/queries/0_stateless/05182_prewhere_partition_statistics.sql
#	tests/queries/0_stateless/05183_prewhere_statistics_throwing_partition.sql
2026-10-03 12:37:16 +00:00
Groene AIandClaude Opus 5.5 3fbc3f6154 Set the Keeper component in LocalServer::processConfig
clickhouse-local set no Keeper component anywhere. Since #123124,
processConfig probes the database disk directly at startup:
tryReadAtomicDatabaseUUID calls existsFile, and
writeMissingDatabaseMetadataFile calls existsFile, createDirectories,
removeFileIfExists, writeMetadataFile and moveFile. On a database_disk
with Keeper-backed metadata each of these is a Keeper request, and with
enforce_keeper_component_tracking on, ZooKeeper::pushRequest throws
LOGICAL_ERROR "Current component is empty", which aborts debug and
sanitizer builds before any query runs.

Set one component as the first statement of processConfig, the same
shape as DisksApp::main. It dominates both helpers and any startup read
added later; ComponentGuard is a thread-local save/restore, so inner
guards (parseQueryFromMetadata, loadMetadata, ...) keep their own names.
Queries run after processConfig and stay at parity with the server.

No test: the Keeper metadata type is registered only under
CLICKHOUSE_CLOUD, so no community configuration reaches the throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 01:39:38 +00:00
George LarionovandClaude Opus 5.5 fb2a4e746c Merge master into ai-functions/ai-service-static-pool
Conflicts were only in the generated settings route maps and explorers: master's
versions plus this branch's `ai_function_*` settings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 22:01:45 +00:00
Konstantin Bogdanov 864fbd35aa Merge pull request #123124 from evillique/local-default-database-metadata-file
Keep `clickhouse-local` tables visible across runs with different `default_database`
2026-10-02 15:49:09 +00:00
Alexey Milovidov abd6a6d5ee Merge pull request #118422 from ClickHouse/default-config-file-yaml
Look up the default configuration file with all supported extensions (`config.yaml`, `config.yml`)
2026-10-02 14:17:28 +00:00
Alexey Milovidov a414005658 Merge remote-tracking branch 'origin/master' into HEAD
# Conflicts:
#	src/Client/LocalConnection.cpp
2026-10-02 11:29:46 +00:00
Alexey Milovidov 9722493b27 Merge remote-tracking branch 'origin/master' into HEAD
# Conflicts:
#	docs/concepts/features/tools-and-utilities/clickhouse-local.mdx
2026-10-02 07:15:52 +00:00
Raúl MarínandClaude Opus 5.5 bf041cd85b Declare secret arguments next to each engine instead of in the parser
Secret masking for logging, `SHOW CREATE` and `EXPLAIN` lived in
`src/Parsers/FunctionSecretArgumentsFinder.cpp`, a switch on the name of
every table function, engine and backup engine that re-implemented their
argument grammar by hand and drifted from it.

Each registration now declares what is secret in its arguments with a
`SecretArgumentsSpec`, a mandatory parameter of `TableFunctionFactory`,
`StorageFactory`, `DatabaseFactory`, `BackupFactory` and
`DictionarySourceFactory` (and an extra `FunctionFactory` overload for
`encrypt`, `HMAC` and friends). Shapes the fields cannot express are
`custom` callbacks living in the translation unit of the engine's argument
parser. The spec also carries the engine `SETTINGS` to hide (replacing the
`SETTINGS_TO_HIDE` includes in `ASTSetQuery`) and the dictionary `SOURCE`
keys (replacing the hardcoded list in `ASTFunctionWithKeyValueArguments`).

The parser keeps only `AbstractFunction`, the result type and the
`ISecretArgumentsFinder` interface. `SecretArgumentsRegistry` implements it
by looking the spec up in the factories and is installed by `server`,
`local` and `format`; an unregistered engine has every argument hidden.
The WebAssembly parser no longer carries the finder.

The masking cases of `gtest_Parser.cpp` move to a stateless test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 23:59:52 +02:00
Robert Schulze 7ba7af801c Move the documentation of SQL statements from StatementFactory into the parsers 2026-10-01 19:38:37 +00:00
George LarionovandClaude Opus 5.5 a78d5faebc Rename AI concurrency and pool settings to ai_function_*
`ai_function_max_concurrent_requests_per_stream` becomes `..._per_thread`, and the
pool settings become `ai_function_max_thread_pool_size`,
`ai_function_max_thread_pool_free_size` and `ai_function_thread_pool_queue_size`.
Regenerated reference docs for these settings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 15:49:34 +00:00