Repository navigation
Conversation
|
Interesting - in my experience, uncompressed cache can lower performance sometimes: https://presentations.clickhouse.com/2021-meetup53/optimizations/ |
|
Workflow [PR], commit [1da7684] Summary: ❌
|
Yeah, uncompressed cache is not universally beneficial and can hurt some workloads for sure. This PR is intentionally much narrower than enabling it by default everywhere. It still respects the existing
|
|
at this point issue in tests is that in s3 storage / azure jobs, the test table lands on remote storage and enable_automatic_use_uncompressed_cache doesn't use remote for caching (tests assumed local). thinking about fix |
8795dd5 to
a76fe91
Compare
…` into the `ON CLUSTER` entry settings The settings of a `DDLLogEntry` are reapplied on the worker via `makeQueryContext` without the fallback for unknown settings, so a worker of an older version would reject every `ON CLUSTER` task issued in a session with an explicit `use_uncompressed_cache = 0` with `UNKNOWN_SETTING` during a rolling upgrade. The opt-out matters only for DDL that reads (`CREATE ... AS SELECT`), and `executeDDLQueryOnCluster` already bakes `SETTINGS use_uncompressed_cache = 0` into the queued query text, which older workers understand. Drop the settings carrier; the existing `05241` cases (including the one where the automatic mode comes only from the entry settings) still pass through the query-text carrier. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cache` to 26.11 The master branch is now 26.11, and the setting has not been released in 26.10. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99639&sha=114393b0cf6&name_0=PR&name_1=Stateless%20tests%20(arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel) ( |
|
The fix is #123121 (merged 2026-10-13). This branch already contains it through the master merge in 0eb561c, so no separate PR is needed. The failing run on 114393b was built without it: its workflow was created on 2026-10-11, before the merge. Since the merge, master has 0 failures of |
# Conflicts: # src/Interpreters/executeDDLQueryOnCluster.cpp
…tRangesReadInfo` The new lazy-materialization read on master (`19ee3397248e`) constructs `PartRangesReadInfo` with the old signature, which this pull request extended with `has_uncompressed_cache`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99639&sha=e5c5db79273448efc3fe62ee3613030df07c5479&name_0=PR&name_1=Fast%20test PR: ClickHouse#99639 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged current
@groeneai, thanks for confirming that |
…uiring hits The control runs of `04612`, `04842` and `05076` expected `UncompressedCacheHits > 0` on the second (warm) run. The stateless tests run with a small uncompressed cache (`small_caches.xml`, 128 MiB) that is shared with concurrent tests, and the `query_log` of the failed runs shows `UncompressedCacheWeightLost` on the first run and only `UncompressedCacheMisses` on the second: the entries were evicted in between. Whether the automatic mode enabled the cache is shown equally well by hits and misses together, so check their sum instead. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99639&sha=efa3bb648be3178be5eddcc0df8df9f2fd673403&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20targeted%29 PR: ClickHouse#99639 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…`CREATE` in its outer `SETTINGS` clause The opt-out was written into the `SETTINGS` clause of the last plain `SELECT` of the source query. That missed a source query whose last element is a set operation (`EXCEPT`, `INTERSECT`, a nested `UNION`), and for `CREATE VIEW` it turned the session opt-out of the creator into a permanent setting of the stored view body. Use the trailing query-level `SETTINGS` clause of the `CREATE` itself instead. `applySettingsFromQuery` applies it before the settings of the source query, whatever its shape, and `InterpreterCreateQuery` resets it (`resetOutputASTIfExist`) before the definition is stored. The formatter wraps the source query in parentheses when this clause is present, so it is re-parsed on the worker as the outer clause. `05241` is extended with an `EXCEPT ALL` source and with a view created under the session opt-out, whose stored definition must not mention `use_uncompressed_cache`. The control runs there also check hits and misses together, because the small test cache shared with concurrent tests can evict the entries of the first run. PR: ClickHouse#99639 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…GS` clauses A `use_uncompressed_cache = 0` in the `SETTINGS` clause of a subquery or of the stored query of a view must win over `enable_automatic_use_uncompressed_cache = 1`. On current master `applyQueryLevelSettings` clamps nested clauses with `CLAMP_ON_VIOLATION_THROW_ON_INVALID`, which keeps changes equal to the current value, so the `changed` flag survives and the opt-out is honored. Add a regression test with a cache-using control. PR: ClickHouse#99639 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oss `SQL SECURITY DEFINER` and `EXECUTE AS` context rebuilds The rebuild clamps the caller's settings changes to the new user's constraints, which drops the default-valued opt-out, while `enable_automatic_use_uncompressed_cache = 1` survives. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…R` views and `EXECUTE AS` Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99639&sha=00b62ef53d2811d1f363572394dbf8b9bb9ab2d7&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The server was OOM-killed ( |
|
Acknowledged. I'm investigating this |
|
The fix is in #131185. The 64 GiB request is the constant argument copied to the size of the block: without It is not #117916: this allocation goes through Why one of these checked requests got past |
Without keys, `Aggregator::prepareAggregateInstructions` materialized every
constant argument to the size of the block. For
`COUNTOrDefaultDistinct(toFixedString('', 1048577))` with
`max_block_size = 65409` that is a 64 GiB request in each
`AggregatingTransform` thread: the AST fuzzer run on PR ClickHouse#99639 had 16 of
them, and the server was OOM-killed at 44 GB RSS.
A function whose state ignores repeated values (`ignoresRepeatedValues()`,
added by ClickHouse#127940) gets the same state from one row as from every row of a
constant. So, without keys, a single constant argument of such a function is
now passed as its one-row data column and added once per block, the way
ClickHouse#127940 adds the used values of a `LowCardinality` argument and the radix
partitioned `uniqExact` routes a constant once per block.
`-Distinct` forwards to the nested function only the values it has not seen,
so it ignores repeated values whatever the nested function is. It now reports
it, which also gives it the `LowCardinality` path without keys.
The JIT branch of `executeWithoutKeyImpl` is not affected: its only caller
passes `use_compiled_functions = false`.
CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99639&sha=00b62ef53d2811d1f363572394dbf8b9bb9ab2d7&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-cache Conflicts: - `src/Interpreters/DDLTask.cpp`: `master` made the settings of a DDL entry unconditional (entry format versions below 3 are rejected). Kept that, with this PR's use of `ClusterProxy::getInitiatorOnlySettingNames` and its comment about the opt-out. - `src/Processors/Sources/LazyReadFromMergeTreeSource.cpp`: `master` builds one read pool per storage snapshot (projection parts). The automatic uncompressed cache decision is still resolved once for the whole second-phase read set and is passed to every pool. - `src/Processors/Transforms/LazyMaterializingTransform.h`: kept both sets of members. - `src/Storages/StorageInMemoryMetadata.cpp`: kept both sets of includes. Semantic adaptation: on `master` the parts of `LazyMaterializingRows` are added by `addPartsOfMainRead` instead of the constructor, so `any_source_parts_on_remote_disk` is now updated there as well. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The final query selected `system.query_log` rows with `log_comment LIKE '05621\_%'`. The test runner sets the default `log_comment` of the test's other queries to the name of the test file, which matches this pattern too, so in CI the result had an extra row `05621_uncompressed_cache_auto_enable_sql_security_opt_out.sh-default`. Select the six comments of the test by their exact names instead. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99639&sha=0fa94ada96c159452344163cc1ca1af1c6e8c7dd&name_0=PR&name_1=Fast%20test ClickHouse#99639 Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🕵 Merged current
Local checks on the merged build: 10 of this PR's 11 stateless tests pass, including the @groeneai, thanks for #131185. It is merged and this branch now contains it. |
…d_cache` to 26.12 The version on `master` is now 26.12, and the `settings_changes_history` style check requires the record of a new setting to be under the current version. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99639&sha=2d270946024ae084a245beb7b9aefa6c39b4d293&name_0=PR&name_1=Style%20check ClickHouse#99639 Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🕵 Merged current
|
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add the setting
enable_automatic_use_uncompressed_cache(disabled by default) that automatically enables the uncompressed cache for eligible local reads from tables in theMergeTreefamily whenuse_uncompressed_cacheis not explicitly set.Documentation entry for user-facing changes
This change improves the
MergeTreeread path by allowing the uncompressed cache to be enabled automatically for small eligible local reads, while keeping the old behavior for remote storage and explicit user settings. The automatic mode is opt-in (enable_automatic_use_uncompressed_cache = 1).The automatic mode is not enabled by default because the server cannot distinguish an explicit
use_uncompressed_cache=0passed as an HTTP query parameter or a command-line client option from an unset one (SettingsConstraints::checkOrClamperases settings changes whose value equals the current value), so a default-on automatic mode would silently override an explicit user opt-out on those paths. OnlySETTINGS use_uncompressed_cache = 0in the query text or a settings profile takes precedence reliably. Defaulting the automatic mode to on would additionally need performance evidence, since the uncompressed cache is not universally beneficial.Workflow [PR]
Sync PR [sync-upstream/pr/99639]