Skip to content

Report unknown elements in a disk configuration - #118440

Merged
alexey-milovidov merged 23 commits into
masterfrom
validate-disk-config-keys
Oct 14, 2026
Merged

alexey-milovidov merged 23 commits into
masterfrom
validate-disk-config-keys

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

Closes: #118425

An element of a disk definition that nothing reads does nothing, and it was accepted silently. A typo, an option of another disk type (e.g. <path> in an S3 disk), an option removed in a newer version, or a completely invented name (lazy_initialization, background_load) all looked exactly like a correct configuration.

Now a disk is created through a proxy of the configuration that remembers which keys have been read, and everything that is left unread inside the section of the disk is reported:

Code: 318. DB::Exception: Unknown elements in the definition of the disk `mydisk` of type `local`:
lazy_initialization, background_load. Nothing reads them, so they have no effect - most likely it is
a typo or an option of another disk type. You can disable this check with
<skip_check_for_incorrect_settings>1</skip_check_for_incorrect_settings>. (UNKNOWN_ELEMENT_IN_CONFIG)

It works both for the disks of storage_configuration and for a disk defined in a query with disk(...), and it is the same error code and the same escape hatch as for an unknown element at the top level of the configuration (ServerSettings::checkUnknownSettings). A disk of a table that is being attached is not checked: its definition has been accepted before, and the data has to be read.

Enumerating the keys of a section is not a read of these keys, but reading a section as a whole (config.has(prefix), as the proxy configuration of a disk does) marks everything inside it as used.

The alternative - a list of the known elements of every disk type - was rejected: the elements of a single disk are read by the disk itself, by the object storage, by the metadata storage, by S3AuthSettings, S3RequestSettings, AzureBlobStorage settings and FileCacheSettings, and such a list would silently go stale, rejecting a valid configuration as soon as someone adds an option and forgets the list. What is actually read is the ground truth, and it cannot go stale.

It also found a class of elements that are options but are read only sometimes: skip_access_check was read as global_skip_access_check || config.getBool(...), and clickhouse-local, clickhouse-disks and the unit tests pass global_skip_access_check = true, so the short circuit never read the element there. The same for the two elements of the authentication of an Azure disk. An element skipped by a short circuit is indistinguishable from an element nothing knows about, so these reads are now unconditional.

The check found the following in our own configuration files, all fixed in this pull request:

  • use_fake_transaction in tests/config/config.d/storage_conf.xml and in test_scheduler_io - an element that has never existed. Two stateless tests were relying on the disk s3_disk_no_fake_transaction being special, while it is an ordinary S3 disk;
  • priority inside a disk in test_stop_insert_when_disk_close_to_full - it is an option of a volume of a policy, not of a disk;
  • retry_attempts, s3_use_adaptive_timeouts and s3_connect_timeout_ms in S3 disks - a request setting of a disk is read with the s3_ prefix and an authentication setting without it, so all three spellings do nothing (the tests that wanted fewer retries have never had them);
  • path in S3 disks - only a local disk has a path; the metadata path of an object storage disk is metadata_path.

Changelog category (leave one):

  • Backward Incompatible Change

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

The definitions of disks in storage_configuration and in disk(...) are validated: an element that nothing reads is reported as UNKNOWN_ELEMENT_IN_CONFIG instead of being silently ignored, which finds typos and options that do not exist for this disk type, such as path in an S3 disk. If a server does not start after the upgrade because of an element it does not know, remove that element from the configuration, or set <skip_check_for_incorrect_settings>1</skip_check_for_incorrect_settings>.


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

Version info

  • Merged into: 26.10.1.2344-master (included in 26.10 and later)

An element of a disk definition that nothing reads does nothing, and it was
accepted silently: a typo, an option of a different disk type, or an invented
name looked exactly like a correct configuration.

The disk is created through a proxy of the configuration remembering which keys
have been read, and everything that is left unread in the section of the disk is
reported as `UNKNOWN_ELEMENT_IN_CONFIG`, the same way as an unknown element at
the top level of the configuration, and with the same
`skip_check_for_incorrect_settings` escape hatch.

Closes: #118425
Found by the check of the previous commit:

- `use_fake_transaction` in `tests/config/config.d/storage_conf.xml` and in
  `test_scheduler_io` - an element that has never existed; the disks named after
  it are ordinary S3 disks;
- `priority` inside a disk in `test_stop_insert_when_disk_close_to_full` - it is
  an option of a volume of a policy, not of a disk;
- `retry_attempts` and `s3_use_adaptive_timeouts` in S3 disks - request settings
  are read with the `s3_` prefix and authentication settings without it, so both
  of these spellings do nothing;
- `s3_connect_timeout_ms` - the same, replaced with `connect_timeout_ms`;
- `path` in S3 disks - only a local disk has a path, the metadata path of an
  object storage disk is `metadata_path`.

The elements that did nothing are removed rather than corrected: they have never
had an effect, so removing them keeps the behavior of the tests exactly as it is.
@clickhouse-gh

clickhouse-gh Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c595e30]

Summary: ✅


AI Review

Summary

This PR adds a tracking configuration proxy so disk definitions reject unread elements at startup and on SYSTEM RELOAD CONFIG, and it cleans up the test/config surfaces that were relying on silent no-op keys. I still would not approve it yet: a brand-new locations subtree is still deferred until after disk->applyNewSettings, so a rejected reload can still mutate live object-storage routing state before UNKNOWN_ELEMENT_IN_CONFIG is raised.

Findings

❌ Blockers

  • [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/118440#discussion_r4189467101] [src/Common/Config/ConfigurationWithUsageTracking.cpp:206; src/Disks/DiskFactory.cpp:143; src/Disks/DiskObjectStorage/DiskObjectStorage.cpp:1021; src/Disks/DiskObjectStorage/Replication/ClusterConfiguration.cpp:39] New locations subtrees are still treated as deferred sections, but only proxy is dry-run validated before mutation. On reload, a disk that gains locations.main (or a new locations.<name>) can update cluster.local / cluster.enabled in place before the post-check notices unread keys in that subtree, so SYSTEM RELOAD CONFIG can still fail after part of the rejected routing config is already live.
    Suggested fix: pre-validate deferred locations sections against a temporary ClusterConfiguration / object-storage view the same way proxy is handled, or reject structural reloads to/from locations before touching the live disk.
Tests
  • ⚠️ Add a focused reload case that starts with a single-location object-storage disk, then reloads a locations.main subtree containing one real local / enabled change plus one unknown child. The command should fail before the live disk observes the new routing flags.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Validate or reject new locations subtrees before DiskObjectStorage::applyNewSettings mutates cluster.
    • Add the focused reload regression test above.

LLVM Coverage Report

Measured on commit c595e30.

Metric Baseline Current Δ
Lines 88.20% 88.20% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 79.70% 79.70% +0.00%

Changed lines: Changed C/C++ lines covered: 222/237 (93.67%) · Uncovered code

Full report · Diff report

@zlareb1

zlareb1 commented Sep 6, 2026

Copy link
Copy Markdown
Member

TL;DR: the check is right, but it will fire on the S3 disk example that the documentation (and the server source itself) tells users to write, so those configs will refuse to start. Filed #118444 for the underlying naming mismatch.

  1. The documentation's S3 disk "Optional parameters" table and the MergeTree page example (also embedded at src/Storages/MergeTree/registerStorageMergeTree.cpp:2338-2339) list retry_attempts and single_read_retries. Nothing reads those names in a disk section: request settings are only probed as s3_retry_attempts / s3_max_single_read_retries (S3Settings::loadFromConfigForObjectStorage passes setting_name_prefix = "s3_"). Verified live on 26.8.2.7 and master head: <retry_attempts>2</retry_attempts> leaves the retry strategy at Attempt 1/501 while <s3_retry_attempts>2</s3_retry_attempts> gives Attempt 1/3.

  2. Today that is a silent no-op (this PR's test-config cleanup shows the same trap: the removed <retry_attempts> knobs never worked). After this PR it becomes UNKNOWN_ELEMENT_IN_CONFIG at startup for a configuration copied verbatim from the documentation. Loud is better than silent, but the docs and the in-source example should be fixed together with (or before) this change, so that following the documentation does not produce a server that refuses to boot.

  3. Small related observation: read_only and readonly are both read in a disk section but by different layers (RegisterDiskObjectStorage.cpp:90 vs the S3Settings.cpp request-settings override), so both spellings pass the new check while meaning slightly different things — maybe worth unifying while touching this area.

@clickhouse-gh clickhouse-gh Bot added the comp-disk-abstractions Core disk abstractions: IDisk interface, DiskLocal, storage policies, volumes, disk management to... label Sep 6, 2026
`skip_access_check` was read as `global_skip_access_check || config.getBool(...)`,
and `clickhouse-local`, `clickhouse-disks` and the unit tests pass
`global_skip_access_check = true`, so the element was never read there and the
check of the previous commits reported it as unknown.

The same for the two elements of the authentication of an Azure disk: the second
one was read only when the first one is present.

An element that is skipped by a short circuit looks exactly like an element that
does not exist, so the configuration is read first and the result is combined
after that.
…e error

The client prints the exception more than once (the message and the query it was
processing), so counting the matching lines gave 2 and 3 instead of 1 and 1.
Print the matched text once instead of counting.
Comment thread src/Disks/DiskFactory.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing c595e3056 with master 28e35c5af (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of eb03aea3a; 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.

Object file sizes

111 object files changed (+167.05 KiB total), 1 added.

Object file Master PR Δ
src/Common/Config/CMakeFiles/clickhouse_common_config.dir/ConfigurationWithUsageTracking.cpp.o new 81.02 KiB +81.02 KiB
src/CMakeFiles/dbms.dir/Disks/DiskFactory.cpp.o 72.91 KiB 151.66 KiB +78.75 KiB (+108.02%)

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

1055 translation units recompiled, 7991 s compile time in total, 1054 of them have a recent master baseline.

Job report

alexey-milovidov and others added 3 commits September 11, 2026 08:23
Reading a section of a disk definition - which is almost always done with
`has` - marked every key inside it as used, so a typo in a nested section
was still accepted silently. For example, `locations.us-east.metdata_path`
or a mistyped key inside `proxy` of an S3 disk did nothing and nothing was
reported, which contradicts the contract of the check.

Now only the keys that are actually read count as used, and a leaf key is
reported no matter how deep it is. The name of a key is printed without the
escaping of the dots that `Poco::Util::AbstractConfiguration::keys` adds.

The cache disk gets the configuration it is defined in, instead of looking
itself up in `storage_configuration.disks`: for a disk defined in a query
there is no such section, so `thread_pool_size` of a cache disk was read
from nowhere and had no effect. For the same reason, `cache_name` is looked
up inside the section of the disk and not at the top level of the
configuration, where a disk from the configuration file could never find it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The CI failures of this pull request are the elements that the tests write
in a disk definition while nothing reads them:

- `path` and `container_name` of an Azure `object_storage` disk: the
  metadata path is `metadata_path`, and the container is taken from
  `endpoint`;
- `readonly` of an `encrypted` disk: it is delegated to the wrapped disk;
- `cache_on_write_operations` outside of a `cache` disk;
- `load_metadata_asynchronously` next to `cache_name`: the settings of the
  cache come from the named collection, and the elements written next to it
  are ignored;
- a duplicated `skip_access_check`;
- `object_metadata_cache_size` of a `plain_rewritable` disk: it stopped
  being read when the metadata storage of `plain_rewritable` was separated
  from `plain`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master and addressed both review findings; the CI reds were all real and are fixed.

The has(...) bypass (Major 1) — reading a section no longer marks the keys inside it as used, so only the leaves that are actually read count. A typo inside locations or proxy is now reported with its full path. Verified locally with a locations disk (locations.one.metdata_path reported; the same config without it starts), and checked that sections read as a whole do not produce false positives: proxy with two uri elements, server_side_encryption_customer_key_base64, data_background_cleanup, repeated key id=... of an encrypted disk, repeated header of an S3 disk. A regression test is in 05104_disk_unknown_config_element (it uses clickhouse-local --config-file, because a nested section cannot be written in the disk(...) syntax).

The documented retry_attempts (Major 2) — already fixed on master by #118444, which is closed: the documentation and registerStorageMergeTree now say s3_retry_attempts / s3_max_single_read_retries.

Two gaps in the disk code the check exposed, fixed here:

  • thread_pool_size of a cache disk was read from storage_configuration.disks.<name>, which does not exist for a disk defined in a query, so it had no effect there. wrapWithCache now gets the configuration of the section the cache disk is defined in.
  • cache_name was looked up at the top level of the configuration instead of inside the section of the disk, so a cache disk from the configuration file could never find its named collection.

Elements removed from the tests, because nothing reads them — path and container_name of an Azure object_storage disk, readonly of an encrypted disk (delegated to the wrapped disk), cache_on_write_operations outside a cache disk, load_metadata_asynchronously next to cache_name (the settings come from the named collection), a duplicated skip_access_check, and object_metadata_cache_size of a plain_rewritable disk — the last one stopped being read when the metadata storage of plain_rewritable was separated from plain, so test_s3_plain_rewritable[s3_plain_rewritable_with_metadata_cache] has not been testing a metadata cache for a while.

On the third observation from the review: read_only and readonly are indeed both accepted by different layers. I left it alone - unifying them is a user-visible rename and does not belong in this change.

Comment thread src/Disks/DiskFactory.cpp Resolved
Comment thread src/Disks/DiskFactory.cpp Resolved
alexey-milovidov and others added 2 commits September 18, 2026 13:39
…oad as well

A disk that already exists is not recreated by `SYSTEM RELOAD CONFIG`: it goes through
`DiskSelector::updateFromConfig` -> `IDisk::applyNewSettings`, which does not pass through
`DiskFactory::create`, so an element added to its section by the reload was accepted silently.

`DiskFactory::applyNewSettings` now applies the reloaded configuration through the same proxy
tracking which keys are read. It starts from the keys that were read while the disk was created:
a key is remembered even when it is absent from the configuration, so this is the set of the
elements the disk type supports, not only the set of the elements that were present. Everything
that is left is an element that neither the creation of the disk nor `applyNewSettings` reads -
the same thing that is reported at the start of the server.

The proxy of the creation is not replaced by the one of the reload, because the parts of a disk
that read the configuration later (`HDFSObjectStorage`) still refer to it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (the branch was 3970 commits behind) and addressed both remaining review threads.

The reload path (Major) — a disk that already exists is not recreated by SYSTEM RELOAD CONFIG: it goes through DiskSelector::updateFromConfig -> IDisk::applyNewSettings, which never passes through DiskFactory::create, so an element added to its section by a reload was still accepted silently. DiskSelector now calls a new DiskFactory::applyNewSettings, which applies the reloaded configuration through the same usage-tracking proxy and runs the same check afterwards.

The proxy of the reload starts from the keys that were read while the disk was created (including type, which the factory reads). A key is remembered even when it is absent from the configuration - getRaw marks it on every probe - so that set is the set of the elements the disk type supports, not only the set of the elements that happened to be present. That makes the check on a reload exactly as strict as the one at the start of the server and no stricter: adding keep_free_space_bytes to a section that did not have it is accepted, adding keep_free_space_byte is reported. The proxy of the creation is deliberately not replaced by the one of the reload, because the parts of a disk that read the configuration later (HDFSObjectStorage) still hold a reference to it.

Verified on a local server: the reload with a real option succeeds, the reload with a typo fails with Unknown element in the definition of the disk \checked_disk` of type `local`: keep_free_space_byte(wrapped intoCANNOT_LOAD_CONFIG), the disk keeps working with the previous configuration, and the next reload without the typo succeeds. The new integration test test_disk_unknown_config_element` covers all three steps.

The documented Azure cache_path — already removed from docs/concepts/features/configuration/server-config/storing-data.mdx on master by 2ede1f3 (#119366) and pulled in by this merge.

The CI reds of the previous run are unrelated to the disks: the Upgrade check one is #110518 (parallel replicas, open), and the two Integration tests jobs failed with ERROR: session-timeout occurred during test execution without a failing test. @groeneai, could you take a look at the session timeouts in Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) and Integration tests (amd_tsan, 3/6), and provide a fix in a separate PR if they are not a one-off? If it is already being worked on, please link it here. The new CI run on the merged branch will show whether they reproduce.

Comment thread src/Disks/DiskFactory.cpp Resolved
Comment thread src/Disks/DiskFactory.cpp Resolved
@groeneai

Copy link
Copy Markdown
Collaborator

Both jobs are the same failure mode, and neither is a stuck test: each ran its shard to ~94% with zero failures and was then cut by the pytest session-timeout about a minute past the 7200 s budget.

  • old analyzer, 6/6: 1234 passed, 34 skipped, 0 failed in 7257.64s (2:00:57), longest gap between log lines 82 s (Kafka fixture bring-up).
  • amd_tsan, 3/6: 1593 passed, 34 skipped, 0 failed in 7244.35s (2:00:44), longest gap 64 s (Iceberg/Spark fixture bring-up).

The ASan half is already fixed by your #118933, so no PR from me. fb5cceef1329 is 685 commits behind its merge 81bd8c66df6a (2026-09-12 17:02:40Z), so it ran on six batches. Same flavor, 30 days, six versus eight batches (minutes, per shard job):

geometry trees p50 p90 p99 trees cut by session-timeout
old analyzer, N/6 9666 103.3 110.7 121.8 222
old analyzer, N/8 1084 80.1 85.7 92.3 0

Your master merge puts this PR on db disk, N/8, and the old analyzer flavor is no longer in job_configs.py at all, so that check name will not come back.

The TSan half is not covered by that change, and it is not a one-off. amd_tsan is the last full-suite integration flavor still on six batches (integration_test_jobs_non_required, for total_batches in (6,)); ASan, MSan and llvm_coverage are all on eight. Over 30 days the arm was cut by the session timeout on 15 of 10667 trees (2/6 11, 3/6 2, 5/6 2), and 3/6 fired again today at 123.5 min on #117784 (7c292497). Its p99 is 105.2 min against a 120 min cap, where amd_msan at eight batches on the same runner class sits at 91.2.

The reasoning already written into ASAN_IT_NUM_BATCHES is flavor-independent (whole suite, AMD_MEDIUM, three xdist workers, two-hour cap), and nothing open addresses the TSan arm, so I am opening a separate PR that takes amd_tsan to eight batches and I will link it here. My #118384, which raised the parallel session timeout to 9000 s, is not the fix and is not being pushed.

@groeneai

Copy link
Copy Markdown
Collaborator

Following up on my measurement above (#118440 (comment)), the amd_tsan half now has a fix: #120883 splits that arm into eight batches, the same lever your #118933 applied to ASan. It was the last full-suite integration flavor still on six.

The old analyzer half needs nothing from me: #118933 already moved it to eight and the cited check name no longer exists on master.

Comment thread src/Disks/DiskFactory.cpp Resolved
alexey-milovidov and others added 3 commits September 25, 2026 16:19
… config, check implicit `default`

- `ConfigurationWithUsageTracking` now holds a reference on the configuration behind it
  (`duplicate` / `release`), so a disk that keeps its creation proxy (`HDFSObjectStorage`) does
  not read a dead configuration: a disk defined in a query has a temporary `XMLConfiguration`,
  and the server configuration is replaced on reload.
- `DiskFactory::applyNewSettings` reports the elements that are unknown for sure before changing
  the live disk, so a rejected `SYSTEM RELOAD CONFIG` does not leave a part of the rejected
  definition applied. Only the inside of a section that the creation has looked at is left
  to the check after `applyNewSettings`.
- The implicit `default` disk now records the elements a `local` disk supports
  (`DiskFactory::trackImplicitLocalDisk`), so a `default` section added later is checked as well.
- `name` and `_server_credentials_allowed` are exempted only for disks defined in a query,
  and at the disk's own prefix.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…eload is applied

The check before `applyNewSettings` skipped the inside of every section the
creation of a disk had looked at, so a typo inside a section that was already
there (e.g. `locations.<name>.localy` next to a change of `enabled`) passed it,
and a part of the rejected definition was applied before the final check.

At the same time it rejected the elements that are read by a pattern of their
names after enumerating a section: a new `key[1]` of an `encrypted` disk and the
settings of a `cache` disk that a reload adopts, which broke
`test_encrypted_disk` and `test_filesystem_cache/test.py::test_dynamic_settings_apply`.

`ConfigurationWithUsageTracking` now remembers which sections were enumerated
and which keys were present, and the check before the reload skips only:
- a leaf inside an enumerated section (it may be read by a pattern);
- a section that was not present at the creation of the disk but was looked at
  or listed in an enumerated section (such as a new `proxy` or a new location).

`FileCacheSettings::loadFromConfig` looks up every cache setting, so that all of
them are known as elements of a `cache` disk, including the ones a reload changes
through `FileCacheFactory::updateSettingsFromConfig`.

Also remove `path` from the `s3` disk of `test_iceberg_disk_client_replacement`,
which nothing reads, and which the new check reports.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118440&sha=ec934a03395872b0017b669b85935f084798a110&name_0=PR
#118440

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits October 4, 2026 21:50
… is applied

The check done before `applyNewSettings` skipped every leaf of a section that the
creation of the disk had enumerated. An `encrypted` disk enumerates the root of its
definition to find the keys, so a key rotation together with `<typo>1</typo>` passed
the check, the new key was applied, and only then the reload was rejected.

Now a leaf of an enumerated section is skipped only if its name starts with the name
of an element of that section that was read before (`key[1]` for `key`, `header_x`
for `header`). The code picking the elements by a pattern of their names looks up the
bare names as well (`getKeysFromConfig` of `DiskEncrypted`, `getHTTPHeaders`,
`S3AuthSettings`, `extractURIList` of a proxy), so that switching from `key` to
`key_hex` on a reload is still accepted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 CI status of the previous head (4ce45bb):

…ed section

The check before `applyNewSettings` of a reloaded disk skipped every leaf of an
enumerated section whose name started with a name read there before, so
`<key_typo>` next to a key rotation of an `encrypted` disk was let through until
after the new key had been applied. `getKeysFromConfig` only accepts `key` and
`key[...]` (and the same for `key_hex`), so a bare name read before now matches
only itself and its repetitions. The readers that really pick elements by an
arbitrary prefix (`getHTTPHeaders`, `S3AuthSettings` users, the proxy URIs) look
up the prefix with `ConfigurationWithUsageTracking::getNamePrefixKey` instead,
which keeps `header_x` working.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 3 commits October 6, 2026 18:53
…load

A `proxy` section that is added to a disk by a configuration reload was
skipped by the check before `applyNewSettings` (the creation of the disk
had only looked it up), but `S3ObjectStorage::applyNewSettings` rebuilds
the client from it right away, so an unknown element inside it was
reported only after the new proxy was already in use.

Read such a section in advance with `ProxyConfigurationResolverProvider`
(which has no side effects) into a separate tracking proxy and report the
elements it leaves unread before the disk is changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`no_sign_request` and `aws_kms_endpoint` (ClickHouse Cloud) are read only
to decrypt a `key_aws` key. A disk created with a plain `key` that gets a
`key_aws` together with these options on a configuration reload had them
reported as unknown before the reload was applied. Look them up in
`getKeysFromConfig`, like the names of the keys themselves.

Found by the private CI of the sync PR (`test_encrypted_disk/test.py::test_add_aws_keys`,
`test_backup_encryption_config`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master, addressed the open review thread (a new proxy section of a disk is now read in advance and judged before applyNewSettings, with a new case in test_disk_unknown_config_element), and fixed the CH Inc sync failures, which were all caused by this PR:

  • s3_with_keeper disk in a private test config had data_cache_enabled / data_cache_max_size, which nothing reads - removed on the sync branch.
  • test_encrypted_disk::test_add_aws_keys and test_backup_encryption_config: a disk created with a plain key that gets key_aws with no_sign_request / aws_kms_endpoint on reload had these options rejected, because the private KMS code reads them only when decrypting such a key. getKeysFromConfig now looks them up under CLICKHOUSE_CLOUD (1a09b1b).

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Public CI is green on c595e30. The CH Inc sync failures are not caused by this PR, so I re-ran the failed private jobs:

  • Received signal 6 (STID: 3567-4db4) in the distributed-cache stateless jobs: std::terminate from MergeTreeTransaction::afterCommit. The same STID shows up on many unrelated sync PRs; tracked in ClickHouse/clickhouse-private#77975.
  • 04072_columns_cache_memory_usage: known flaky (ClickHouse/clickhouse-private#79437, fix in Measure exact query memory in 04072_columns_cache_memory_usage #123949).
  • test_keeper_raft_event_loop_wedge, 03029_shared_merge_tree_slow_merge, 01900_kill_mutation_parallel_long, the msan stress hung check and the amd_msan 1/8 timeout: Keeper, merge or infrastructure areas this PR does not touch.

alexey-milovidov pushed a commit to raimannma/ClickHouse that referenced this pull request Oct 11, 2026
Integration tests (amd_tsan, N/6) runs the whole integration suite on
AMD_MEDIUM with three xdist workers against a two-hour pytest
--session-timeout (session_timeout_parallel = 7200s). Six batches leave no
margin: on runs where nothing failed at all, the heaviest shard (5/6) sits at
a median of 92.4 minutes, 77% of the 120-minute budget, and over 30 days 347
clean jobs across the six shards ran past 110 minutes. When ordinary per-tree
variance consumes the rest, xdist aborts the session and the job reports
"ERROR: session-timeout occurred during test execution" with partial results
and an unrun tail, so a real failure in that tail is invisible. Three jobs in
30 days were cut with zero other failing tests: 3/6 twice, seven days apart
(fb5ccee, 7c29249), and 5/6 once (baab92b). The remaining
Timeout rows on 2/6 co-occur with test_storage_nats/test_nats_jet_stream.py
failures and are a separate defect, not counted here.

Rather than raise the session timeout, raise the batch count, which is the
lever already applied to every other full-suite integration flavor: ASan
(ASAN_IT_NUM_BATCHES), MSan and LLVM coverage all run eight batches on the
same runner class, and amd_tsan was the last one still on six. The aggregate
compute is unchanged (same tests, two more per-batch setups) and the job
returns its answer sooner. Two independent estimates agree on the effect: the
same-flavor 6-to-8 ratio measured on the ASan arm (0.78 at p50/p90/p99) puts
the heaviest TSan shard at about 72 minutes, and repacking the ~529 minutes of
median per-tree work over eight batches at the observed packing spread puts it
at about 69 minutes, so roughly 58% of budget instead of 77%. That is the band
amd_msan already occupies at eight batches on the same runner class.

This reduces the exposure rather than eliminating it: amd_msan at eight
batches still produced two Timeout rows in 30 days. It also does not address
the 2/6 NATS failures, which are not a capacity problem.

No test is weakened or skipped.

Related: ClickHouse#118440

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A kind of invented solution, but I don't mind the invention. LGTM.

@alexey-milovidov alexey-milovidov self-assigned this Oct 14, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 14, 2026
Merged via the queue into master with commit 032874f Oct 14, 2026
150 checks passed
@alexey-milovidov
alexey-milovidov deleted the validate-disk-config-keys branch October 14, 2026 01:36
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 14, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

@alexey-milovidov — title/description suggestions:

Description (currently misleading):

  • Why: Two claims do not match the code: (1) "reading a section as a whole (config.has(prefix)) marks everything inside it as used" - the final code reports leaves inside such sections (05104 asserts locations.one.metdata_path); (2) "a disk of a table that is being attached is not checked" - only server-start/force-restore loading is exempt, short ATTACH and RESTORE are checked. The example shows Code: 318; UNKNOWN_ELEMENT_IN_CONFIG is 137. Side changes are not mentioned.

  • Suggested addition:

    • has of a section does not mark its children as used; every leaf inside a section must be read.
    • Exempt from the check: tables loaded at server start (FORCE_ATTACH/FORCE_RESTORE) only.
    • Config reload of storage_configuration now fails when a disk definition gains an unknown element (checked before and after applyNewSettings).
    • cache_name is now looked up inside the disk section, so a cache disk from the config file can use a named collection.
    • The cache layer of a disk is built from the cache disk's own definition, so disk(type = cache, ...) now honors its own options (thread_pool_size, data_background_cleanup, ...) instead of the server config.

Ignore if intentional.

@clickgapai

Copy link
Copy Markdown
Contributor

@alexey-milovidov — ClickGap found the following in this PR:

Close anything that's wrong or already addressed.

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 30, 2026
`s3_validate_request_settings` is a query setting, and a disk definition
never reads it. Since ClickHouse#118440 the server refuses to start on an unknown
element in a disk definition (`Code: 137 ... Unknown element in the
definition of the disk broken_s3 of type s3: s3_validate_request_settings`),
so on current master every case of the module failed at setup with a
timeout waiting for the instance to start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-disk-abstractions Core disk abstractions: IDisk interface, DiskLocal, storage policies, volumes, disk management to... pr-backward-incompatible Pull request with backwards incompatible changes pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown elements in a disk configuration are silently ignored

5 participants