Skip to content

Cherry pick #124930 to 26.8: Fix ATTACH for S3 disks created without 'remote_url_allow_hosts - #125667

Merged
robot-ch-test-poll merged 10 commits into
backport/26.8/124930from
cherrypick/26.8/124930
Oct 14, 2026
Merged

robot-ch-test-poll merged 10 commits into
backport/26.8/124930from
cherrypick/26.8/124930

Conversation

@robot-ch-test-poll4

Copy link
Copy Markdown
Contributor

Original pull-request #124930

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

alexbakharew and others added 9 commits October 9, 2026 16:21
… for the disk check

Two paths still enforced `remote_url_allow_hosts` on definitions that the
server stored itself:

- Databases at server start. `loadDatabase` runs the stored `ATTACH DATABASE`
  with `create = true`, so `setForceAttach` is skipped and the mode is `ATTACH`,
  not `FORCE_ATTACH`. The server did not start in CI with a database whose
  metadata disk points to an endpoint outside the list. The signal for this
  path is `is_metadata_replay`.
- A short `ATTACH TABLE t` or `ATTACH DATABASE db` reads the definition back
  from the metadata file and marks it with `attach_short_syntax`, while the
  mode is `ATTACH`.

`DatabaseFactory::Arguments::isLoadingFromExistingMetadata` combines the mode,
`is_metadata_replay` and `attach_short_syntax` for the database metadata disk.
`registerStorageMergeTree` adds `attach_short_syntax` to the mode for tables.
A user `ATTACH` with a full definition keeps `attach_short_syntax` false and
stays enforced.

The log line, the `system.warnings` text, the comments and the docs name the
third event.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…`DETACH PERMANENTLY`

In an `Atomic` database a full-definition `ATTACH TABLE` needs a `UUID`;
without it the query fails with `INCORRECT_QUERY` before the disk is built,
which is what CI reported. The case now passes a `UUID` and expects
`UNACCEPTABLE_URL`.

A table detached permanently before the upgrade has no disk at server start,
so the short `ATTACH TABLE t_detached` on the new binary is the first creation
of its disk: it must be accepted and reported. The database case adds a
`DETACH DATABASE` / `ATTACH DATABASE` cycle and uses the default restart wait.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…rt and `UNDROP`

The previous commit set the `is_loading_from_existing_metadata` flag for a
short `ATTACH TABLE t` / `ATTACH DATABASE db`. That flag is shared by every
custom-disk check (`dynamic_disk_allow_*`, the server-credentials marker,
the local-paths check, the disk-name and settings-hash checks), so the change
silenced all of them for the short form, not only the host filter.

The host filter now follows the other disk checks: skipped when the server
replays metadata it stored itself, at start (`is_metadata_replay`, mode
`FORCE_ATTACH` / `FORCE_RESTORE`) and on `UNDROP`, enforced for every user
`ATTACH`, short or with a definition. A table parked with
`DETACH ... PERMANENTLY` before the upgrade gets `UNACCEPTABLE_URL` on its
first `ATTACH` until the operator adds the `<s3_bucket>` entry; `DETACH` and
`ATTACH` in a running server reuse the disk built at start and are not
affected.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…er the entry is added

The permanently detached table now expects `UNACCEPTABLE_URL` on its first
`ATTACH`, consistent with `CREATE` and with a full-definition `ATTACH`. The
test then adds `<s3_bucket>minio1:9001/root</s3_bucket>` to the allow-list,
reloads the config and attaches the table without a restart. The
`DETACH DATABASE` / `ATTACH DATABASE` cycle stays as a check that a reused
metadata disk is not re-validated.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
A table dropped before the upgrade stays in the drop queue and is rebuilt at
server start from `metadata_dropped` under `FORCE_RESTORE`. The test drops a
table on a third disk before the restart, checks that two disks were reported,
and runs `UNDROP TABLE` on the new binary. The drop delay is raised to one hour
in the test config so the queue survives a slow restart under sanitizers. The
docs sentence now says what the code does: the exemption is the rebuild at
start, which is what keeps `UNDROP TABLE` working.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…te-host-filter-on-load

Fix ATTACH for S3 disks created without 'remote_url_allow_hosts
@robot-ch-test-poll4 robot-ch-test-poll4 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Oct 13, 2026
Adapted to this branch, which carries #124453 on the pre-#110665 factory API:
the third `ObjectStorageFactory::create` parameter becomes
`RemoteHostFilterCheck remote_host_filter_check` next to `skip_access_check`,
and `registerDiskObjectStorage` derives it from its `attach` and `custom_disk`
arguments. `RemoteHostFilter::checkURL` keeps this branch's unmasked message
and only gains the early returns. `DatabaseFactory::Arguments` has no
`is_restore_from_backup` here, so only `isLoadingFromExistingMetadata` is added.

The backward-compatibility test starts from the pinned image `26.8.26.12`
(built 2026-10-13, before #124453 reached this branch) instead of the floating
`26.8` tag, which will soon include the check itself and would fail to create
the disks.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@robot-ch-test-poll
robot-ch-test-poll merged commit 2c9463e into backport/26.8/124930 Oct 14, 2026
1 check passed
@robot-ch-test-poll
robot-ch-test-poll deleted the cherrypick/26.8/124930 branch October 14, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants