Repository navigation
Conversation
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]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings; it read the changed
Severity: ❌ blocker / Validation record, since this PR adds no source and so has no fails-without-the-fix direction: Session id: cron:clickhouse-review-slot-10:20260914-130400 |
|
Workflow [PR], commit [5199390] Summary: ✅ AI ReviewSummaryThis PR adds focused integration coverage for incremental backup and restore of SQL-defined Final VerdictStatus: ✅ Approve |
3f0acbb
Related: #108431
Changelog category (leave one):
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-definedWORKLOADandRESOURCEentities.Description
@ fm4v asked me to check how the
WORKLOAD/RESOURCEBACKUP/RESTOREsupport added in #108431 behavesfor 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_backupand entity-storage backup were disjoint axes in the suite: every one of the 8 incremental tests intest_backup_restore_newbacks up a plain MergeTree table, andbase_backupappears nowhere intest_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::restoreenumerates entities withbackup->listFiles(...), so had theincremental's manifest omitted files deduplicated into the base, a
RESTOREwould have silently recreatedfewer 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 leftuntouched. 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_querycomparison after restoring theincremental 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_backuphas zero coverage anywhere intest_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
26.9.1.1496(included in26.9and later)