Repository navigation
Report unknown elements in a disk configuration - #118440
Conversation
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.
… the marker of a dynamic S3 disk
|
Workflow [PR], commit [c595e30] Summary: ✅
AI ReviewSummaryThis PR adds a tracking configuration proxy so disk definitions reject unread elements at startup and on Findings❌ Blockers
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit c595e30.
Changed lines: Changed C/C++ lines covered: 222/237 (93.67%) · Uncovered code |
|
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.
|
`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.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes111 object files changed (+167.05 KiB total), 1 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units1055 translation units recompiled, 7991 s compile time in total, 1054 of them have a recent master baseline. |
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]>
|
🕵 Merged The The documented Two gaps in the disk code the check exposed, fixed here:
Elements removed from the tests, because nothing reads them — On the third observation from the review: |
…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]>
|
🕵 Merged The reload path (Major) — a disk that already exists is not recreated by The proxy of the reload starts from the keys that were read while the disk was created (including Verified on a local server: the reload with a real option succeeds, the reload with a typo fails with The documented Azure The CI reds of the previous run are unrelated to the disks: the |
…tion test Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
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
The ASan half is already fixed by your #118933, so no PR from me.
Your master merge puts this PR on The TSan half is not covered by that change, and it is not a one-off. The reasoning already written into |
|
Following up on my measurement above (#118440 (comment)), the The |
… 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]>
… 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]>
|
🕵 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]>
…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]>
|
🕵 Merged
|
|
🕵 Public CI is green on c595e30. The
|
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
left a comment
There was a problem hiding this comment.
A kind of invented solution, but I don't mind the invention. LGTM.
|
@alexey-milovidov — title/description suggestions: Description (currently
Ignore if intentional. |
|
@alexey-milovidov — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
`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]>
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:
It works both for the disks of
storage_configurationand for a disk defined in a query withdisk(...), 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,AzureBlobStoragesettings andFileCacheSettings, 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_checkwas read asglobal_skip_access_check || config.getBool(...), andclickhouse-local,clickhouse-disksand the unit tests passglobal_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_transactionintests/config/config.d/storage_conf.xmland intest_scheduler_io- an element that has never existed. Two stateless tests were relying on the disks3_disk_no_fake_transactionbeing special, while it is an ordinary S3 disk;priorityinside a disk intest_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_timeoutsands3_connect_timeout_msin S3 disks - a request setting of a disk is read with thes3_prefix and an authentication setting without it, so all three spellings do nothing (the tests that wanted fewer retries have never had them);pathin S3 disks - only a local disk has a path; the metadata path of an object storage disk ismetadata_path.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The definitions of disks in
storage_configurationand indisk(...)are validated: an element that nothing reads is reported asUNKNOWN_ELEMENT_IN_CONFIGinstead of being silently ignored, which finds typos and options that do not exist for this disk type, such aspathin 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
26.10.1.2344-master(included in26.10and later)