Skip to content

Cover incremental backups of WORKLOAD and RESOURCE entities - #119975

Merged
jkartseva merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/cover-incremental-backup-workload-resource-entities
Sep 14, 2026
Merged

jkartseva merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/cover-incremental-backup-workload-resource-entities

Conversation

@groeneai

@groeneai groeneai commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #108431

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Add an integration test covering incremental backups (SETTINGS base_backup) of SQL-defined WORKLOAD and RESOURCE entities.

Description

@ fm4v asked me to check how the WORKLOAD / RESOURCE BACKUP/RESTORE support added in #108431 behaves
for incremental backups and snapshots. I found no defect in either mode; the measured report is in the #108431
thread, and this PR closes the coverage gap the ask pointed at.

base_backup and entity-storage backup were disjoint axes in the suite: every one of the 8 incremental tests in
test_backup_restore_new backs up a plain MergeTree table, and base_backup appears nowhere in
test_backup_restore_on_cluster/ or in either WORKLOAD/RESOURCE test file. No test, for access entities, UDFs,
workloads or resources, did full -> incremental -> restore-from-incremental. That case is the consequential
one: WorkloadEntityStorageBase::restore enumerates entities with backup->listFiles(...), so had the
incremental's manifest omitted files deduplicated into the base, a RESTORE would have silently recreated
fewer entities than existed. It does not: the manifest carries a <file> element for every file with
<use_base>, and restoring the incremental alone returns the complete set.

The new test walks one evolving entity set across a base and an incremental with four carriers: a resource
created after the base, a workload dropped after it, a workload whose definition is extended (a strict
byte-prefix extension, so the incremental stores only , max_concurrent_threads = 4), and a resource left
untouched. Oracles: an exact-list check that only the changed workload and the new resource carry bytes, the
byte-exact suffix of the prefix-reused file, and a full name, create_query comparison after restoring the
incremental alone.

Validation: full module 5/5, the new test 5/5 repeated, and six mutation controls (five redden the assertion
they target; the sixth confirms the arming assertions are load-bearing).

Deliberately not covered: incremental x ON CLUSTER (base_backup has zero coverage anywhere in
test_backup_restore_on_cluster/, a pre-existing subsystem-wide hole) and chained incrementals (generic,
already pinned by 02915_lazy_loading_of_base_backups.sh).


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

Version info

  • Merged into: 26.9.1.1496 (included in 26.9 and later)

PR ClickHouse#108431 added BACKUP/RESTORE for SQL-defined WORKLOAD and RESOURCE
entities, and @fm4v asked whether that support holds for incremental
backups. It does, but nothing exercised it: base_backup and
entity-storage backup were disjoint axes in the test suite. All eight
incremental tests in test_backup_restore_new back up test.table,
base_backup appears nowhere in test_backup_restore_on_cluster/, and no
test for access entities, UDFs, workloads or resources did full then
incremental then restore-from-incremental.

That last case is the consequential one. WorkloadEntityStorageBase::restore
enumerates entities with backup->listFiles(), so had an incremental's
manifest omitted files deduplicated into the base, a RESTORE would have
silently recreated fewer workloads and resources than existed. Measured
on master: the manifest carries a <file> element for every file, each
with <use_base>, and restoring the incremental alone returns the
complete set.

The new test walks one evolving entity set across a base and an
incremental so that a single flow carries all three
checkBaseBackupForFile outcomes plus deletion: a resource created after
the base (HasNothing), a workload dropped after it, a workload extended
by one setting (HasPrefix, since BackupEntryFromMemory allows a partial
checksum and formatWithSecretsOneLine appends), and a resource left
untouched (HasFull). The exact-list oracle on the incremental's contents
proves in one assertion that only the changed workload and the new
resource carry bytes. Carrier three gets its own byte-exact assertion
because the restored create_query reads the same whether prefix reuse
engaged or the whole definition was rewritten.

Verified by mutating each carrier out in turn and confirming the
targeted assertion reddens, and by removing the drops to confirm the
arming assertions are load-bearing.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 14, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings; it read the changed
module and configs in full and independently ran the focused test 1/1 and the full module 5/5).
My own cold review found 3 items, all nit level; two were text hygiene in the PR description and
in the report on #108431, both corrected before posting. The one worth recording here:

# Sev Finding Verdict Evidence / action
1 💡 The HasNothing dedup outcome is carried only by sql_res2, a name absent from the base backup, so the test takes the no-base-entry branch of buildFileInfoForBackupEntry. The other route into HasNothing, a name present in the base whose new definition is not a byte-prefix extension, is not exercised here or by any other entity-storage test. AGREE, not blocking For a BackupEntryFromMemory the partial checksum is computed in memory and both routes end in the same store-the-whole-file disposition, so nothing entity-specific distinguishes them. Left out deliberately rather than missed.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Validation record, since this PR adds no source and so has no fails-without-the-fix direction:
the equivalent proof is that each assertion reddens when the property it targets breaks. Six
controls were run against one binary, each the committed test with a single mutation: dropping
the new resource, dropping the DROP WORKLOAD, restoring the base instead of the incremental,
dropping the definition extension, and also modifying the supposedly untouched resource all
redden the assertion they target; a sixth, with the arming assertions removed, passes and so
shows those lines are load-bearing. Suite runs: 4/4 on the pristine module, 5/5 with the new
test (twice), and the new test 5/5 back to back.

Session id: cron:clickhouse-review-slot-10:20260914-130400

@clickhouse-gh clickhouse-gh Bot closed this Sep 14, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 14, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5199390]

Summary: ✅


AI Review

Summary

This PR adds focused integration coverage for incremental backup and restore of SQL-defined WORKLOAD and RESOURCE entities, including an unchanged entity resolved through the base backup, a dropped entity, a newly added entity, and a definition stored as an incremental suffix. I read the current diff, the full modified test module, the relevant restore and backup code paths, and the prior discussion; I did not find a correctness, safety, or coverage issue that warrants blocking the change.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 14, 2026
@groeneai
groeneai requested a review from jkartseva September 14, 2026 13:34
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 14, 2026

@jkartseva jkartseva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM; cc @serxa

@jkartseva
jkartseva added this pull request to the merge queue Sep 14, 2026
Merged via the queue into ClickHouse:master with commit 3f0acbb Sep 14, 2026
186 of 348 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 14, 2026
@clickhouse-gh clickhouse-gh Bot added comp-backup Backup/restore infrastructure and backup formats. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-backup Backup/restore infrastructure and backup formats. groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-ci 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.

4 participants