Skip to content

Backport #113574 to 26.8: Fix RESTORE of tables on read-only storage that provides their data (backup_metadata_only) - #127532

Merged
clickhouse-gh[bot] merged 6 commits into
26.8from
backport/26.8/113574
Oct 24, 2026
Merged

clickhouse-gh[bot] merged 6 commits into
26.8from
backport/26.8/113574

Conversation

@robot-ch-test-poll3

@robot-ch-test-poll3 robot-ch-test-poll3 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #113574
Cherry-pick pull-request #127091

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 26.8.35.12

…e that provides their data (`backup_metadata_only`)
@robot-ch-test-poll3 robot-ch-test-poll3 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Oct 23, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [b9ade63]

Summary: ✅

jkartseva and others added 5 commits October 23, 2026 14:57
On `master` `StorageTimeSeries::getTargetKinds` is a `static constexpr` returning every possible target kind,
so the backported code called it on the class. On 26.8 it is a non-static const member returning the kinds
this table actually has, which does not compile as a qualified call:

    error: call to non-static member function without an object argument

The loop already holds `time_series` and filters every kind through `isInnerTable`, so calling the member on
that table keeps the behavior: it iterates this table's own kinds instead of all of them, and the filter makes
the two sets agree.

Co-Authored-By: Claude Opus 5 <[email protected]>
The branch decides `should_backup_data` and leaves the loop at once when it is false, while on master the
partition checks run first, so that naming a partition of a table that cannot back one up is still refused
however the data came to be left out. The cherry-pick put the new `backup_metadata_only` check after that early
exit, where it cannot be reached: leaving the data out is exactly what the flag does, so
`BACKUP ... PARTITIONS` of such a table was accepted and restored as the whole table.

The two checks move above the exit, as on master. `test_backup_restore_s3_plain_backup_metadata_only` and
`test_partitions_of_table_not_created_on_replica` assert the refusal; the first of them also left its table
behind when it failed there, which is what then made `test_backup_restore_with_s3_throttle` restore that table
into a UUID that was still taken.

Co-Authored-By: Claude Opus 5 <[email protected]>
…` on the table

`StorageTimeSeries::getTargetKinds` is a `static constexpr` on master and a non-static const member on this
branch, so the cherry-pick did not compile. Calling it on the table would work, but it is the only thing the
branch needs it for, and it only produces a warning: `isDataOnBackupMetadataOnlyStoragePolicy` answers `false`
for a `TimeSeries` table either way, as the table keeps no data of its own. So the lookup of its inner tables is
left out, with the assertion of that warning dropped from the test, and `context` becomes unused here.

Co-Authored-By: Claude Opus 5 <[email protected]>
…helpers for

Trimmed to what the original change is about - a table on a `backup_metadata_only` storage policy has its data
left out of a backup and a restore - with everything the branch cannot express removed:

- `castStorage`, `DeferredTable` and `resolveStorageProxyLoading` come from #121332, which is not on this branch,
  so the casts are plain `std::dynamic_pointer_cast`. A table behind a `StorageProxy` is no longer resolved, so
  its data is backed up as usual rather than left out.
- `warnBackupMetadataOnlyIgnored` and the lookups of the inner tables of a materialized view and a `TimeSeries`
  table are gone. They only logged, and the answer does not depend on them: the flag is ignored for both kinds
  either way. The test asserts the backups still succeed instead of asserting the warnings.

`context` is unused in the overload that is left, and the includes the removed code needed are dropped.

Co-Authored-By: Claude Opus 5 <[email protected]>
`test_replicated_merge_tree_ignores_the_flag` asserted the line `warnBackupMetadataOnlyIgnored` writes for an
engine of the `MergeTree` family that is not the plain one. That warning was left out of this branch along with
the rest of the diagnostics, so the assertion fails while the behavior it guards - the flag ignored, the data
backed up as usual, a new UUID after a `structure_only` restore - is unchanged and still asserted.

Co-Authored-By: Claude Opus 5 <[email protected]>
@clickhouse-gh
clickhouse-gh Bot merged commit 98b9ef8 into 26.8 Oct 24, 2026
41 checks passed
@clickhouse-gh
clickhouse-gh Bot deleted the backport/26.8/113574 branch October 24, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants