Skip to content

Do not create a disk defined in SQL while deciding whether ALTER ... MODIFY SETTING disk is allowed - #119850

Merged
alexey-milovidov merged 16 commits into
masterfrom
sec-custom-disk-local-paths
Oct 3, 2026
Merged

alexey-milovidov merged 16 commits into
masterfrom
sec-custom-disk-local-paths

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

ALTER TABLE ... MODIFY SETTING disk = disk(type = local, path = '<outside>') bypassed the custom_local_disks_base_directory fence for disks defined in SQL: the statement succeeded, the disk was registered in system.disks, and its directory was created outside the base directory.

The fence (since #110665 it lives in the disk factories) runs only for a fresh definition, not for one loaded from stored metadata. Several computations that run before the ALTER is known to be allowed rebuild the post-ALTER settings only to read a scalar out of them, and they applied the whole change list as if it came from stored metadata: refreshSettingsDerivedMetadata (the implicit minmax indices), MergeTreeData::checkAlterEligibility (projection and part-format checks), and checkColumnFilenamesForCollision. Resolving the disk setting creates and registers the disk, so the first of them created it unchecked, and the later fresh-definition check found it already registered and never ran.

None of those computations reads disk, so they now use the new MergeTreeSettings::applyChangesLeavingDiskUnresolved, which leaves the disk change out. The check in checkAlterEligibility still resolves the new disk as a fresh definition, and MergeTreeData::changeSettings resolves it once the statement has passed.

Verified on a local server: without the change, the ALTER above succeeds, registers the disk and creates the directory. With it, the ALTER is rejected and nothing is left behind (05217_custom_disk_local_path_alter.sh). An integration case in test_s3_credentials_hardening also checks that an include cannot slip a locations.<name> child of type local with a path outside the base directory past the fence.

Related: #110665

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

ALTER TABLE ... MODIFY SETTING disk = disk(...) could register a disk defined in SQL whose local path is outside custom_local_disks_base_directory, and create its directory, bypassing the check that CREATE TABLE applies. Now it is rejected the same way, and a statement rejected this way leaves no disk and no directory behind.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.10.1.1451-master (included in 26.10 and later)
  • Backported to: 26.8.20.6, 26.7.24.7

…an name

Two locations of a disk created by a `disk(...)` clause were not confined:

The name of the disk is used verbatim as a path component of the state the server
keeps for it - the metadata storage builds `<clickhouse path>/disks/<name>/` and
creates that directory - so a name containing a path separator or `..` relocated
server-managed state to any directory the server can write to, `user_scripts/`
among them. The name must now be a plain name.

The `custom_local_disks_base_directory` fence was applied only to disks that
report `isRemote() == false`, which `DiskObjectStorage` never does - not even
when its backing object storage is the local filesystem, where `path` is a plain
directory that the query just named, and where the metadata is written to the
local filesystem as well. The fence now asks whether the backing storage is
local instead, and covers both locations. This is a backward incompatible change
for a disk defined in SQL as `object_storage` over `local`: such a disk now
requires `custom_local_disks_base_directory` to be configured and its `path` and
`metadata_path` to be inside it, the same requirement that `type = local` disks
have had. Disks defined in the server configuration are not affected, and neither
is attaching a table that already uses such a disk.

Finally, the entries that `DatabaseCatalog::maybeRemoveDirectory` is asked to
remove are exactly the ones that failed the "is a directory" test, so they can be
regular files, and widening a regular file's mode to `S_IRWXU` makes it
executable. Removal needs write and execute permissions on the directory whose
entries are unlinked, not any permission on the entry itself, so only a directory
gets its mode widened now.

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

clickhouse-gh Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [747619c]

Summary: ✅


AI Review

Summary

This PR fixes the main single-node bypass where several pre-validation ALTER TABLE ... MODIFY SETTING disk = disk(...) computations materialized a custom disk before the local-path fence ran, and the new stateless/integration tests cover those reject-on-fence cases well. I still see one blocker: the new pre-constraint resolveDiskSetting step runs before secondary-replay detection, so a Replicated / Shared Catalog follower can re-validate the disk(...) as a fresh definition and reject an ALTER that the initiator already accepted and persisted.

Findings
  • ❌ Blockers
    • [src/Storages/MergeTree/MergeTreeData.cpp:6530] This new resolution runs before the replay checks immediately below, so a table that previously had no SETTINGS clause now hits the fresh-definition path on secondary execution too. On a follower with stricter local config (for example a different custom_local_disks_base_directory or dynamic-disk credential policy), replaying ALTER ... MODIFY SETTING disk = disk(...) can now throw an exception here even though the initiator already accepted the change and wrote it to replicated metadata. That stops the replay and can leave replicas diverged.
      Suggested fix: compute the secondary-replay flag before this call and, on replay, either skip the fresh resolution entirely or resolve with is_loading_from_existing_metadata = true. The code already skips checkMergeTreeSettingsConstraints on replay for exactly this “local config must not veto persisted metadata” reason.
  • ⚠️ Majors
    • [src/Storages/MergeTree/MergeTreeData.cpp:6530] [dismissed by author -- https://github.com/Do not create a disk defined in SQL while deciding whether ALTER ... MODIFY SETTING disk is allowed #119850#discussion_r4103362663] The code still materializes a valid custom disk during validation, so a later failure in the same ALTER can leave that disk registered even though the statement as a whole is rejected. The author narrowed the PR contract to fence-rejected definitions only, but this is still a real observable side effect, and the new no-previous-SETTINGS path at 6530 widens it to tables that previously skipped the older old_metadata.hasSettingsChanges() branch.
      Suggested fix: delay custom-disk creation until after the last throwing validation, or roll the disk registration back on exception.
Tests
  • The new 05217_custom_disk_local_path_alter.sh and test_dynamic_disk_include_locations_child_local_path_is_fenced cover single-node rejection paths, but there is still no regression that replays ALTER ... MODIFY SETTING disk = disk(...) through a secondary Replicated / Shared Catalog execution with asymmetric local config. That gap is exactly where the blocker hides.
Final Verdict
  • ❌ Needs changes before merge.

LLVM Coverage Report

Measured on commit 747619c.

Metric Baseline Current Δ
Lines 88.10% 88.10% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 79.50% 79.50% +0.00%

Changed lines: Changed C/C++ lines covered: 28/33 (84.85%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-backward-incompatible Pull request with backwards incompatible changes label Sep 13, 2026
alexey-milovidov and others added 2 commits September 13, 2026 20:41
…disks

These tests define a disk backed by the local filesystem in SQL and give it a
path next to the data directory rather than inside `disks/`, which this change
confines them to.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… the server

Two corrections, both found by the functional tests.

A relative path of a disk backed by the local filesystem was resolved against the
working directory of the process, which is not a property of the server: it is
`/` under systemd, the log directory when running as a daemon, and the directory
the server happened to be started from otherwise. So the same definition
described a different location on the next start, and no directory could be said
to contain it. Such a path is now resolved against the directory of the server,
which is what every such definition already means in the environments where it
works today. The metadata path of an object storage disk is resolved the same
way.

The containment check asked the created disk for its path, which sees through a
disk that refers to a disk of the server configuration: a `cache` disk over a
configured local disk was refused because of the path the administrator gave
that disk. The check now reads the locations out of the disk definition, so it
covers exactly what the query named - and it runs before the disk is created, so
a rejected definition also creates no directory.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the comp-multidisk Multiple disks/volumes storage policies, disk abstractions. label Sep 13, 2026
…ctory

The working directory of the server process, which the filesystem resolves a
relative path against, is not a property of the server: it is `/` under systemd,
the log directory when running as a daemon, and the directory the server was
started from otherwise - and it is not the data directory in the test
environment either. A relative path therefore named a different place depending
on how the server was started, and no directory could be said to contain it.

A relative path of a disk defined in SQL is now resolved against
`custom_local_disks_base_directory`, so it is inside that directory by
construction, and the definition keeps naming the same place on the next start.
An absolute path still has to be inside that directory. Both the data and the
metadata location of the disk are resolved in the disk definition before the
disk is created, so the disk uses exactly the location that was checked.

Because of that, the tests that give their disk a relative path did not need to
change after all; only the one test that built an absolute path out of the data
directory of the server had to name the base directory instead.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment thread src/Disks/DiskFromAST.cpp Resolved
Comment thread src/Disks/DiskFromAST.cpp Resolved
… test

The disks the test creates on purpose stay registered for the lifetime of the
server, so a pattern over `system.disks` counted them on the second run.

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

clickhouse-gh Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 747619ca9 with master c662045b0 (stripped binary size, per-symbol sizes and ThinLTO time; 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.

Compile time of recompiled translation units

105 translation units recompiled, 1366 s compile time in total, 105 of them have a recent master baseline.

Median compile-time ratio to the baselines is ×1.25 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost +280.2 s (+26%) in total before that adjustment.

Job report

…finition

An `ATTACH TABLE` that writes the disk out in the query names a location just as
a `CREATE TABLE` does, so it is checked the same way; only loading a table from
the metadata the server already stored is not.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment thread src/Disks/DiskFromAST.cpp Resolved
A `type = local` disk passes the path to the filesystem exactly as it was given,
so there is nothing to resolve for it, and the check that runs after it is
created is truthful as it stands. Its wording matters too: a test reads the
configured base directory out of that message.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment thread src/Disks/DiskFromAST.cpp Resolved
Resolving a relative path against the base directory made the disk write
somewhere the definition did not name, which in the test environment is a
directory shared by every job on the runner rather than the sandbox of the run -
a leftover from an earlier run then broke the `plain_rewritable` metadata of a
later one, and the whole shard with it.

The check now compares the location exactly as the definition gives it, which is
also exactly how the disk uses it. A relative path is resolved by the filesystem
against the working directory of the process - `/` under systemd - so it is
inside the base directory only by accident, and the tests that had one now name
the base directory instead, the way the tests of `type = local` disks already
did. `04103` becomes a shell test for that reason, and gives its disk a per-run
directory: its metadata lives in that directory, so a leftover from another run
is not inert.

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

Copy link
Copy Markdown
Member Author

Stateless tests (amd_llvm_coverage, old analyzer, s3 storage, DBReplicated, parallel, 1/3) reports 121 failures, 119 of them Internal query (CREATE/DROP DATABASE) failed after the two real ones - 05060_create_or_replace_scoped_grants and 03636_storage_alias_metadata_access_rights, neither of which goes near a disk. The server did not crash: there is no <Fatal> in its log, and the fence added here rejected nothing at all - custom local disk and Base path for custom appear zero times in the whole log. The shard is a known one to collapse this way; the same check with about a hundred failures at once is on master and on unrelated pull requests in the last week. Re-running it.

@lukaszszafranski lukaszszafranski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @alexey-milovidov for the opportunity to run our tool on this PR. Here are the findings that we found:

Veridical.dev reviewed the change:

  • Merge readiness — ⛔ Do not merge
  • Correctness — 🟠 Needs work
  • Security — 🟠 Flagged
  • Tests — 🟡 Three focused coverage suggestions; overall coverage is not established
  • Changed hunks with no finding — 80% (finding distribution only, not review recall)

7 surfaced items · 2 with source/evidence text attached

📝 Walkthrough

Confines SQL-defined local disks to the configured base directory, validates names and metadata paths before registration, and avoids making removable files executable. The patch updates affected integration and stateless tests to use the allowed disk directory.

File Change
src/Disks/DiskFromAST.cpp Validates custom disk names, data paths, and metadata paths before creation.
src/Interpreters/DatabaseCatalog.cpp Limits chmod during cleanup to directories.
tests/integration/test_attach_backup_from_s3_plain/configs/disk_s3.xml Configures the allowed base directory for the test.
tests/queries/0_stateless/04103_plain_rewritable_get_last_modified_bug.sh Uses the runtime disk directory in the rewritten regression.
tests/queries/0_stateless/05216_custom_disk_local_path_validation.sql Exercises invalid names, outside paths, metadata traversal, cleanup, and valid disks.
15 additional changed test files Move custom local-disk paths beneath the configured base directory.
🗺️ How the changes interact
flowchart TD
A[SQL custom disk definition] --> B[DiskFromAST validation]
B --> C{Path and name allowed?}
C -->|No| D[Reject]
C -->|Yes| E[Create or reuse disk]
E --> F[Local filesystem]
H[Test configuration] --> I[Allowed base directory]
I --> B
J[Updated regressions] --> A
K[DatabaseCatalog cleanup] --> L[chmod directories only]
Loading

Supported defects

Severity Where Issue
🟠 High src/Disks/DiskFromAST.cpp:187 The backup exemption trusts a SQL-supplied disk name, allowing a plain local disk to skip the confinement fence.
🟡 Medium src/Disks/DiskFromAST.cpp:187 A rejected type = local disk can create or touch its out-of-base path before the post-construction validation runs.

Nonblocking observations

🔍 Five coverage and cleanup observations
  • Add a direct type = local rejection case and assert that the rejected path was not created.
  • Add a negative case for the type = local_blob_storage compatibility spelling.
  • Exercise each representable invalid-name predicate, not only a slash-containing name.
  • Correct the cleanup comment in DatabaseCatalog.cpp; valid directories without a UUID mapping can reach the helper too.
  • Align the disk-name error text with the implemented exact . / .. checks.

Findings that were reported by other bots

clickhouse-gh had already reported these findings on the same head, so Veridical will not repost them as original findings:

  • Resolved locations.* local backends introduced through include are not traversed by the root-only pre-check. Veridical independently generated the same mechanism, but terminal verification left it inconclusive and withheld it.
  • Live ALTER TABLE ... MODIFY SETTING disk = disk(type = local, ...) can memoize an unchecked disk during the metadata-loading pass. Veridical ingested that thread; the separate medium finding above is retained only because it adds distinct evidence that DiskLocal::setup() creates the rejected directory before the fence runs.
🔬 How the two supported defects were verified
  • src/Disks/DiskFromAST.cpp:187 — DiskFactory::create receives the user-derived disk_name, and the branch skips checkCustomDiskPathIsAllowed whenever that resulting name equals backup.
  • src/Disks/DiskFromAST.cpp:187 — the pre-creation helper excludes plain local disks, while DiskLocal::setup() performs create_directories before control reaches this check.

Review scope: complete

The reviewed revision changes 20 files / 190 added lines. All 20 changed files were supplied to the review; no changed file was skipped. The changed-hunk percentage above describes where findings landed, not which files were omitted.


Reviewed by Veridical · ultra depth · some optional execution checks did not complete

Comment thread src/Disks/DiskFromAST.cpp Resolved
Comment thread src/Disks/DiskFromAST.cpp Resolved
@kssenii kssenii self-assigned this Sep 18, 2026
Comment thread src/Interpreters/DatabaseCatalog.cpp Resolved
alexey-milovidov and others added 6 commits September 19, 2026 13:09
… by its type

Two locations escaped the fence. A multi-location `DiskObjectStorage` builds one
object storage per `locations.<name>` child, each with its own backend and its
own `path`, so an `include` could resolve a local child behind a root that names
a remote backend, and the check only ever looked at the root. And a plain
`type = local` disk was checked only after `DiskFactory::create` had built and
started it, so `DiskLocal::setup` created the rejected directory first, and
`ALTER TABLE ... MODIFY SETTING disk = disk(type = local, ...)` slipped past
entirely: it resolves the disk once with `is_loading_from_existing_metadata`,
which memoizes it in `Context::getOrCreateDisk`, and the stricter pass that
follows finds the disk already there and never runs the check.

Both are now checked before the disk is created, by one rule: every backend of
the resolved configuration - the root and every `locations.<name>` child -
whose type starts with `local` has its `path` checked. The check that runs after
the disk is created stays as a backstop for the local disks whose directory the
definition does not name outright.

Its exemption for the backup disk went by the disk name, which the query
chooses, so `disk(name = 'backup', type = local, path = '/etc/')` avoided the
only fence a plain local disk had. It goes by the type of the disk now.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`05217` covers `ALTER TABLE ... MODIFY SETTING disk = disk(type = local, ...)`,
a disk named `backup`, and the absence of a directory for a disk the fence
rejected. The integration test covers a `locations.<name>` child that an
`include` resolves to a local backend outside the base directory.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…allowed

`ALTER TABLE ... MODIFY SETTING disk = disk(type = local, path = '...')` was
rejected, and yet left the disk registered and its directory created. Several
computations that run before the statement is known to be allowed rebuild the
settings the table would end up with - `AlterCommands::apply` for the implicit
index settings, `checkAlterIsPossible` for the projection and part-format
checks, `checkColumnFilenamesForCollision` - and each of them applied the whole
change list as if it came from stored metadata, which resolves the `disk`
setting, and resolving it creates and registers the disk.

None of those computations reads the `disk` setting, so they now apply the
changes with `applyChangesLeavingDiskUnresolved`, which leaves it alone. The
settings update itself, `MergeTreeData::changeSettings`, still resolves it - by
then the statement has passed the check.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…al-paths

Master gained #110665, which moved the
`custom_local_disks_base_directory` fence into the disk factories (`DiskLocal`, the local object
storage, `metadata_path`, `encrypted`, every `locations.<name>` child), added the disk-name check,
and dropped the name-based `backup` exemption. That covers the checks this branch added to
`DiskFromAST.cpp`, so the file is taken from master as is, and `05216`, which duplicated master's
`05212_custom_disk_local_paths_confined`, is removed. The `custom_local_disks_base_directory` key this
branch added to `test_attach_backup_from_s3_plain` is already on master.

What master does not cover is kept: the factory checks run only for `!attach`, and the computations
that rebuild the post-`ALTER` settings resolved `disk` as if it came from stored metadata, which
created and registered an unchecked disk. `refreshSettingsDerivedMetadata`, which replaced the
inline block in `AlterCommand::apply`, now uses `applyChangesLeavingDiskUnresolved` as well.

The `DatabaseCatalog::maybeRemoveDirectory` change is dropped, as asked in review, to keep this fix
minimal for backporting.
Since #110665 the path check runs inside the disk
factory, and the server log line of the exception is forwarded to the client by
`--send_logs_level`, so the message appears twice on stderr. Stop at the first match.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@alexey-milovidov alexey-milovidov changed the title Confine the local filesystem locations a custom disk defined in SQL can name Do not create a disk defined in SQL while deciding whether ALTER ... MODIFY SETTING disk is allowed Sep 25, 2026
…e fence tests

`alter_effective_settings` left `disk` at its default, so the diff passed to
`checkMergeTreeSettingsConstraints` missed a change of `disk` on a table that
had none, and reported one on every ALTER of a table that had one. Resolve the
new `disk` there instead, as a fresh definition when it changes, so the fence
runs before anything registers the disk.

Extend 05217 to a local object storage disk, an outside `metadata_path`, a
table without a SETTINGS clause, and a constant `merge_tree_disk` constraint.

`test_dynamic_disk_include_locations_child_local_path_is_fenced` never reached
the path check: a `type = object_storage` disk with an `include` and no literal
`object_storage_type` is treated as possibly S3 and rejected with ACCESS_DENIED
first. Lift the S3 credentials restriction for that query.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@clickhouse-gh clickhouse-gh Bot removed the pr-backward-incompatible Pull request with backwards incompatible changes label Oct 2, 2026
@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 2, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 On the AI review's remaining major: a definition the fence rejects is never built. The fence runs in the disk factory before DiskLocal::setup, so a path outside custom_local_disks_base_directory leaves no disk and no directory behind, and 05217 asserts that. What the review describes is different. It is a disk whose definition passes the fence (its path is inside the base directory) and that stays registered when a later, unrelated check of the same statement fails, e.g. storage_policy together with disk.

That is not specific to ALTER and it is not a bypass. CREATE TABLE ... SETTINGS disk = disk(...), storage_policy = '...' on master does the same thing: MergeTreeSettings::loadFromQuery resolves (creates) the disk and only then throws storage_policy and disk cannot be specified at the same time. Avoiding this would take a dry-run mode for DiskFromAST::createCustomDisk or a rollback of the disk registry on failure, for both CREATE and ALTER. Reviewers asked to keep this PR minimal because it is meant to be backported, so I am leaving that out of here. I narrowed the PR description to say that a statement the fence rejects leaves nothing behind.

I also merged master (747619c).

auto new_changes = new_metadata.settings_changes->as<const ASTSetQuery &>().changes;
/// The settings constraints below compare the resolved `disk`, so it is resolved here. A changed
/// `disk` is a fresh definition and is checked as one, before anything registers the disk unchecked.
MergeTreeSettings::resolveDiskSetting(new_changes, local_context, /*is_loading_from_existing_metadata=*/!disk_setting_changed);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This new resolveDiskSetting call runs before the secondary-replay checks just below. That matters for the new “table had no previous SETTINGS clause” case this hunk is fixing: on a Replicated / Shared Catalog follower, replaying ALTER ... MODIFY SETTING disk = disk(...) now takes the fresh-definition path here with is_loading_from_existing_metadata = false.

If that follower has stricter local config (custom_local_disks_base_directory, dynamic-disk credential policy, etc.), it can throw an exception here even though the initiator already accepted the ALTER and persisted it. changeSettings replays the same metadata with is_loading_from_existing_metadata = true, so this path needs the same replay exemption: compute the replay flag first and skip the fresh resolution here (or resolve with true) on non-initial executions.

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.

Not a problem.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 3, 2026
Merged via the queue into master with commit fb091ad Oct 3, 2026
150 checks passed
@alexey-milovidov
alexey-milovidov deleted the sec-custom-disk-local-paths branch October 3, 2026 22:06
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 3, 2026
@kssenii kssenii added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Oct 5, 2026
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 5, 2026
alexey-milovidov added a commit that referenced this pull request Oct 6, 2026
Resolve the conflicts of the cherry-pick of #119850 to 26.7.

On 26.7, `refreshSettingsDerivedMetadata` does not exist (the implicit index refresh is
inline in `AlterCommands::apply`), and the post-ALTER effective settings in
`MergeTreeData::checkAlterIsPossible` are built inside the replay check instead of in
`checkAlterEligibility`. The change is ported to those places: the implicit index refresh and
`checkColumnFilenamesForCollision` and the part format check use
`applyChangesLeavingDiskUnresolved`, and the effective settings for the constraints check
resolve `disk` with `is_loading_from_existing_metadata = !disk_setting_changed` under `local_context`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
robot-clickhouse added a commit that referenced this pull request Oct 6, 2026
Cherry pick #119850 to 26.7: Do not create a disk defined in SQL while deciding whether `ALTER ... MODIFY SETTING disk` is allowed
robot-clickhouse added a commit that referenced this pull request Oct 6, 2026
…eciding whether `ALTER ... MODIFY SETTING disk` is allowed
robot-clickhouse added a commit that referenced this pull request Oct 6, 2026
Cherry pick #119850 to 26.8: Do not create a disk defined in SQL while deciding whether `ALTER ... MODIFY SETTING disk` is allowed
robot-clickhouse added a commit that referenced this pull request Oct 6, 2026
…eciding whether `ALTER ... MODIFY SETTING disk` is allowed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 6, 2026
alexey-milovidov added a commit that referenced this pull request Oct 6, 2026
The tests of #119850 also cover behaviour that came from
#110665, which was not
backported to 26.8 (its cherry-pick was closed). In 26.8 the
`custom_local_disks_base_directory` check of a disk defined in SQL runs
after the disk is registered and its directory created, does not cover
object storage disks over the local filesystem (they are reported as
remote), and exempts a disk named `backup`.

Keep the part that this backport fixes: `ALTER TABLE ... MODIFY SETTING
disk = disk(...)` with a local path outside the base directory is now
rejected, and the settings constraints still compare the resolved disk.
Drop the checks of registration and directory creation, the object
storage cases, and the integration test for a `locations` child with a
local backend, which all depend on #110665.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=124151&sha=1348e3964bcfa0dfa2569720e5461b11401f7b5b&name_0=BackportPR
PR: #124151

Co-Authored-By: Claude Opus 5.5 <[email protected]>
clickhouse-gh Bot added a commit that referenced this pull request Oct 6, 2026
Backport #119850 to 26.8: Do not create a disk defined in SQL while deciding whether `ALTER ... MODIFY SETTING disk` is allowed
clickhouse-gh Bot added a commit that referenced this pull request Oct 7, 2026
Backport #119850 to 26.7: Do not create a disk defined in SQL while deciding whether `ALTER ... MODIFY SETTING disk` is allowed
@clickhouse-gh clickhouse-gh Bot added comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. and removed comp-multidisk Multiple disks/volumes storage policies, disk abstractions. labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

6 participants