Repository navigation
Fix identity of dynamic disks with server credential markers - #129044
Conversation
A dynamic disk is named after a hash of its definition, which includes the credential markers the server appends. The Azure marker is now added only when the resolved disk uses the server's own Azure identity, and a definition that matches no registered disk is also tried in the forms stored by older versions. A short `ATTACH` keeps the stored markers. A session without `s3_allow_server_credentials_in_user_queries` can no longer use a disk with server credentials through a wrapper disk or a definition that resolves differently since the disk was created. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [ec8919f] Summary: ✅
AI ReviewSummaryThe PR preserves dynamic-disk identities across credential-marker changes, keeps stored definitions on short Missing context / blind spots
Final Verdict✅ Approve. No unresolved findings or new inline comments. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes129 object files changed (+59.52 KiB total), 0 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 units1118 translation units recompiled, 8395 s compile time in total, 1118 of them have a recent master baseline. |
A session without `s3_allow_server_credentials_in_user_queries` could use a disk with server credentials through its implicit `__<disk>` storage policy. Refuse it on `CREATE`, user `ATTACH` and `ALTER ... MODIFY SETTING`. A disk function now passes every registered disk it matches to the disk that wraps it, so a wrapper declared by an older version is found even when the disk of the newer form below it is registered too. Move the paths of the `encrypted` disks in 05496 inside `custom_local_disks_base_directory`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…LTER `StorageFactory::Arguments::getDisk` and `getStoragePolicy` resolve a disk or a storage policy named by a table definition and, unless the table is loaded from existing metadata, refuse a custom disk with server credentials for a session without `s3_allow_server_credentials_in_user_queries`. `Log`, `TinyLog`, `StripeLog`, `Set`, `Join`, `Distributed` and the MergeTree `storage_policy` setting use them. `ALTER ... MODIFY SETTING storage_policy` checks the policy only when it changes. In 05496, wrap local disks under `custom_local_disks_base_directory` and drop every table right away, so that no table names a disk of another table. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/Storages/StorageFactory.h
A forbidden `storage_policy` must be reported by the constraint check, not as an unknown policy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master now checks the effective storage policy before the per-setting loop, so the credentials check has to run there to be reported first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/Storages/MergeTree/MergeTreeSettings.cpp
The release has no Azure server credentials marker (#120343), so only the form without `_server_credentials_allowed` is tried, and the Azure test is dropped. The `storage_policy` check of `ALTER` runs in the per-setting loop of the release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The release has no Azure server credentials marker (#120343), so only the form without `_server_credentials_allowed` is tried, and the Azure test is dropped. The `storage_policy` check of `ALTER` runs in the per-setting loop of the release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry pick #129044 to 26.8: Fix identity of dynamic disks with server credential markers
Cherry pick #129044 to 26.9: Fix identity of dynamic disks with server credential markers
Cherry pick #129044 to 26.10: Fix identity of dynamic disks with server credential markers
Backport #129044 to 26.8: Fix identity of dynamic disks with server credential markers
Backport #129044 to 26.9: Fix identity of dynamic disks with server credential markers
Backport #129044 to 26.10: Fix identity of dynamic disks with server credential markers
…s-on-detach Conflicts with #129044, which tries older forms of a custom disk definition (other credentials markers) and checks the disks a table names by name: - `getOrCreateCustomDisk` keeps both the alternatives of master and the registration of this PR. The registrations of the disks of the first form are passed as the nested ones: if another form is chosen, its disk exists already, and its registration owns its own nested registrations. - `createCustomDisk`, `loadFromQuery` and `resolveDiskSetting` take `stored_definition` and return a registration. - `Log`, `StripeLog`, `Set` and `Join` use the new `StorageFactory::Arguments::getDiskWithCustomDiskRegistration`, which checks the disk as `getDisk` does and takes its registration together with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…server_credentials_disk` The test from #129044 relied on a custom disk staying registered after its table is dropped. With this PR, a disk is released when the last table using it is gone, so wrapping `SERVER_DISK`, `WRAPPER_DISK` or `PLAIN_DISK` by name failed with `BAD_ARGUMENTS` (no such disk), and the `from_zk` wrapper would have been created anew instead of being reused. Keep the tables defining these disks until the end of the test, and drop them before it ends. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The stress `default` profile sets `ast_fuzzer_runs = 5` and `ast_fuzzer_any_query = true`, so every successful CREATE of 05496_dynamic_disk_wrapper_of_server_credentials_disk is replayed as `created__fuzz_N` / `t_policy__fuzz_N`. The test drops only `created` and `t_policy`, and the copies name by reference the disks and storage policies (`plain_<db>`, `server_<db>`, `__plain_<db>`, `__server_<db>`) that only the dropped tables defined, or resolve them through Keeper nodes the test removes at the end. After the post-stress restart nothing defines those names, the copy's metadata cannot be parsed and the server does not start (`Cannot start clickhouse-server`, 11 Stress rows since ClickHouse#129044 merged, including master and the 26.10 backport branch). Stress also passes `ignore_drop_queries_probability=0.2` to every client, and an ignored DROP of `created` or `t_policy` leaves a table that cannot be loaded after the restart either. Pin `--ast_fuzzer_any_query=0 --ignore_drop_queries_probability=0` on the test's client (the same pair as 05321). With `ast_fuzzer_any_query = 0` `executeASTFuzzerQueries` returns early for every non-read-only seed, and the test issues only DDL. The appended values win over the stress client options because clickhouse-test passes `--allow_repeated_settings` and the client keeps the last occurrence. Local reproduction with the stress fuzzer profile (debug build, CI config): unpatched, 3 runs in a fixed database left 8 copies and the restart with `async_load_databases = false` failed with `Code: 478 Unknown storage policy __plain_test_1 ... created__fuzz_84.sql`; with every DROP ignored it failed with `Code: 478 ... __server_test_1 ... t_policy.sql`. Patched: 0 copies, 0 ignored DROPs of the test's tables, the restart succeeds; 50/50 randomized runs pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A dynamic disk declared with
disk(...)is named after a hash of its definition, and the server appends credential markers (_server_credentials_allowed,_azure_server_credentials_allowed) to that definition. The markers made the identity of a disk unstable: tables created before a marker existed could not share or re-attach their disk after an upgrade, and on master the Azure marker made the identity depend on the session'ss3_allow_server_credentials_in_user_queries, so a named disk was refused and an unnamed one was silently replaced by a new, empty disk.ATTACHkeeps the markers stored in the table metadata as they are.encrypted,cache), or through a definition that resolves differently since the disk was created. This covers S3 and Azure, and every location of a multi-location disk.A table created with the opt-in that reuses a disk declared before the markers stores the definition of that disk, so after a restart it has the same credentials as the tables already on it.
Closes: #128876
Closes: #127409
Related: #106855
Related: #120343
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed dynamic disks (
disk(...)in table settings) that usefrom_env,from_zkorinclude: after an upgrade, or depending ons3_allow_server_credentials_in_user_queries, they got a different identity, so they could not be shared or re-attached, or the table was attached to a new, empty disk. A session withouts3_allow_server_credentials_in_user_queriescan no longer use a disk with server credentials through a wrapper disk.Workflow [PR]
Sync PR [sync-upstream/pr/129044]
Version info
26.11.1.1829-master(included in26.11and later)