Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
LeftHandCold
left a comment
There was a problem hiding this comment.
Review 结论:需要修改(1 个 P1 正确性 blocker),不建议合并。当前认证账号 LeftHandCold 与 PR 作者相同,GitHub 不允许自我 REQUEST_CHANGES,因此用带 inline finding 的 COMMENT 记录结论。
范围:base/merge-base 3d22c69 → HEAD 5f10768,完整检查两个文件及 checkpoint producer → loader → copy → rewrite 消费闭环。普通 bug fix,设计文档门禁不适用;恢复数据正确性按高风险核查。
关键区别是“在 checkpoint 收集结束前已删除”不等于“在备份恢复时间点已删除”。新增测试使用 create=5/start=15/drop=end=30,本身正处于必须恢复该对象的时间区间,却只断言 copy 成功,未验证 rewrite 后的存活引用及其文件存在性。应增加源文件仍存在的 non-appendable 对象控制:完成 checkpoint 重写后,对每个恢复为 live 的对象验证目标文件可读;保留确实不再需要的历史对象及 missing-live 硬错误控制。不能将现有 focused test/50 次重复当成恢复完整性的证明。
验证边界:本轮结论依据确定的生产代码路径与现有测试输入,未声称运行了端到端恢复;未启动重型 UT/BVT 或生产操作。diff --check 通过;当前 CI 的 UT/BVT 仍 pending,不能称全绿。
Q1–Q3 增量检查:
| 维度 | 结论 |
|---|---|
| Q1 所有权 | 新 helper 只操作调用内 map/对象引用;没有新增外部资源或清理责任。恢复所需物理文件的遗漏见 P1。 |
| Q2 等待 | 未新增锁、等待或 retry;沿用现有 copy scheduler/cancel 路径。 |
| Q3 增长 | 新 map 按输入对象数分配,softDeletes 按所选 checkpoint 的唯一对象累计,仅本次调用持有;未发现新增跨调用累积。 |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Review 结论:REQUEST_CHANGES。Exact head: 5f10768
Confirmed blocker
P1 — pkg/backup/tae.go:527 仅因对象存在 DropTS 就将其从复制集合中剔除,但这不等价于对象在备份恢复时间点已经不可见。
具体反例:非 appendable 对象 O 的 createTS=5、备份裁剪时间 start=15、dropTS=30,special checkpoint end=30;O 在时间 15 仍然存活。新筛选将 O 标记为 soft-deleted 并跳过复制。随后 pkg/vm/engine/tae/logtail/backup.go:833 对非 appendable 对象保留原 ObjectStats、不补复制物理文件,而 logtail/backup.go:1031 又清空 DeleteTS,使恢复 checkpoint 中 O 成为 live。结果是备份可以完成,但恢复元数据引用目标目录中不存在的 O,恢复后读取失败。该路径不依赖 GC 竞态。
修复建议:按恢复时间点及重写依赖判断对象是否必需,保留具体生命周期信息,不能只使用删除名称集合;至少保留 createTS < start < dropTS 且重写仍引用的非 appendable 对象,并在必需文件缺失时显式报错。
测试证据不足
pkg/backup/backup_test.go:124 使用相同的 5/15/30 时间关系,但只验证 helper/复制阶段,未执行完整 selection → copy → rewrite → restore,也未验证重写后的 live 引用及目标文件可读。现有 TestBackupData 未确定性覆盖该时间窗口;重复运行不能替代恢复 oracle。建议增加真实物理对象回归测试,覆盖 drop 在 start 前、等于 start、start 后,以及 appendable/tombstone 对照,并在恢复后扫描验证数据。
尚未验证的风险
未执行本地 UT、实际反例恢复、SQL/BVT、race、故障注入、性能及版本兼容矩阵。tae.go:522 按全部 checkpoint 对象记录数预分配 map 的峰值内存/分配/长尾未测,但目前不单独认定为 blocker。
|
对 #pullrequestreview-5153457593 的 P1 已在 现在仅在 回归用例直接采用 review 给出的 |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Review conclusion: APPROVE.
Exact head: c06bdd5
The previous P1 is fixed: selection now skips only records with non-empty DropTS < restoreTS, preserving the required non-appendable object through copy and rewrite. The prior 5/15/30 counterexample now retains the object and its physical file.
No confirmed blocker found. Non-blocking suggestions: strengthen the test with a valid decodable object and restored-row scan; cover empty/HLC logical timestamps, appendable/tombstone objects, incremental backup, and duplicate lifecycle records.
Unverified: local Go UT/race/vet, live restoration counterexample, SQL/BVT regression, fault injection, benchmarks, and compatibility matrix.
Merge Queue Status
This pull request spent 30 minutes 6 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #28525 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28473. ## What this PR does / why we need it: Backup selects checkpoint object files before rewriting the special checkpoint to its `start` timestamp. A physical object may already be absent because it was logically deleted before that restored snapshot and then collected by normal GC. After matrixorigin#26290 correctly made missing checkpoint objects fail, attempting to copy such a historical object aborts the entire backup with error 20405. A `DropTS` alone is not sufficient to omit an object. If `DropTS >= special checkpoint start`, the checkpoint rewrite retains the object as live at the restored timestamp, and the physical file must remain in the copy set. This change selects from each `BackupObject` lifecycle timestamp: - omit only objects with `DropTS < restoreTS`; - retain objects with `DropTS == restoreTS` or `DropTS > restoreTS`; - retain the existing hard error for any required source file that is missing; - keep the prior conservative behavior when there is no special checkpoint timestamp. This does not modify GC, checkpoint selection, backup protection, global-index de-duplication, checkpoint rewrite format, or restore metadata. ## Design and validation - Added `TestExecBackupKeepsObjectDeletedAfterRestoreTimestamp` using a real special checkpoint with `create=5/start=15/drop=30`. It copies the non-appendable object, runs checkpoint rewrite, and verifies both the rewritten live metadata reference and the target physical object. - Added `TestSelectBackupObjectsOnlySkipsObjectsDeletedBeforeRestoreTimestamp`, covering `DropTS <`, `==`, and `>` restore timestamp. - Retained `TestParallelCopyDataReturnsMissingSourceObject` as the negative control that a required missing source still returns 20405. - Focused three-case regression, `pkg/backup` full package, and `go vet ./pkg/backup` passed at `c06bdd547b`. A distributed BVT is not added because this changes the internal TN checkpoint-object selection boundary. The owning package tests exercise the checkpoint loader, copy set, rewrite, and missing-source behavior deterministically. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28473. ## What this PR does / why we need it: Backup selects checkpoint object files before rewriting the special checkpoint to its `start` timestamp. A physical object may already be absent because it was logically deleted before that restored snapshot and then collected by normal GC. After matrixorigin#26290 correctly made missing checkpoint objects fail, attempting to copy such a historical object aborts the entire backup with error 20405. A `DropTS` alone is not sufficient to omit an object. If `DropTS >= special checkpoint start`, the checkpoint rewrite retains the object as live at the restored timestamp, and the physical file must remain in the copy set. This change selects from each `BackupObject` lifecycle timestamp: - omit only objects with `DropTS < restoreTS`; - retain objects with `DropTS == restoreTS` or `DropTS > restoreTS`; - retain the existing hard error for any required source file that is missing; - keep the prior conservative behavior when there is no special checkpoint timestamp. This does not modify GC, checkpoint selection, backup protection, global-index de-duplication, checkpoint rewrite format, or restore metadata. ## Design and validation - Added `TestExecBackupKeepsObjectDeletedAfterRestoreTimestamp` using a real special checkpoint with `create=5/start=15/drop=30`. It copies the non-appendable object, runs checkpoint rewrite, and verifies both the rewritten live metadata reference and the target physical object. - Added `TestSelectBackupObjectsOnlySkipsObjectsDeletedBeforeRestoreTimestamp`, covering `DropTS <`, `==`, and `>` restore timestamp. - Retained `TestParallelCopyDataReturnsMissingSourceObject` as the negative control that a required missing source still returns 20405. - Focused three-case regression, `pkg/backup` full package, and `go vet ./pkg/backup` passed at `c06bdd547b`. A distributed BVT is not added because this changes the internal TN checkpoint-object selection boundary. The owning package tests exercise the checkpoint loader, copy set, rewrite, and missing-source behavior deterministically. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28473. ## What this PR does / why we need it: Backup selects checkpoint object files before rewriting the special checkpoint to its `start` timestamp. A physical object may already be absent because it was logically deleted before that restored snapshot and then collected by normal GC. After matrixorigin#26290 correctly made missing checkpoint objects fail, attempting to copy such a historical object aborts the entire backup with error 20405. A `DropTS` alone is not sufficient to omit an object. If `DropTS >= special checkpoint start`, the checkpoint rewrite retains the object as live at the restored timestamp, and the physical file must remain in the copy set. This change selects from each `BackupObject` lifecycle timestamp: - omit only objects with `DropTS < restoreTS`; - retain objects with `DropTS == restoreTS` or `DropTS > restoreTS`; - retain the existing hard error for any required source file that is missing; - keep the prior conservative behavior when there is no special checkpoint timestamp. This does not modify GC, checkpoint selection, backup protection, global-index de-duplication, checkpoint rewrite format, or restore metadata. ## Design and validation - Added `TestExecBackupKeepsObjectDeletedAfterRestoreTimestamp` using a real special checkpoint with `create=5/start=15/drop=30`. It copies the non-appendable object, runs checkpoint rewrite, and verifies both the rewritten live metadata reference and the target physical object. - Added `TestSelectBackupObjectsOnlySkipsObjectsDeletedBeforeRestoreTimestamp`, covering `DropTS <`, `==`, and `>` restore timestamp. - Retained `TestParallelCopyDataReturnsMissingSourceObject` as the negative control that a required missing source still returns 20405. - Focused three-case regression, `pkg/backup` full package, and `go vet ./pkg/backup` passed at `c06bdd547b`. A distributed BVT is not added because this changes the internal TN checkpoint-object selection boundary. The owning package tests exercise the checkpoint loader, copy set, rewrite, and missing-source behavior deterministically. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…ckups (#29504) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #28473 on `4.2-dev`. Backports #28525 and corrects historical-object selection, retained references, and the incomplete GC census assumption found in this PR's reviews. This does not close the corresponding main-branch work or claim that previously missing files can be recovered. ## What this PR does / why we need it: Backup can see separate creation and deletion records for one physical object. Filtering only the deletion record still tries to copy an object already reclaimed by GC. Conversely, filtering every old deletion can omit snapshot/PITR data and publish a successful but incomplete backup. The final correction resolves lifecycle identity before physical deduplication, retains compacted checkpoint references, and requires a committed GC census before using absence to omit an old object. Shared live owners, creation epochs, object types, restore timestamp boundaries, required-copy OR, and incremental destination reuse remain part of that selection contract. A GC filename is only a recovery watermark: `CopyGCDir` can advance it without scanning the new interval. `GCWindow` now persists one bounded actual scan interval in an optional second metadata block, committed with its remaining-object set. Only complete incremental scans grant proof. Merge preserves real contiguous coverage and keeps a proven suffix across gaps; rename, replay and GC filtering cannot manufacture coverage. Backup reads candidate metadata and streams one selected remaining set. Existing block zero and restore-watermark behavior remain unchanged; old readers consume block zero, and legacy metadata provides no absence proof. Malformed proof and incomplete checkpoint/GC reads fail closed. The obsolete `softDeletes` loader argument and collection path are removed. Checkpoint row-read errors now propagate through the loader and GC collector, preventing partial input from reaching successful publication. Design: [trusted GC scan evidence](https://github.com/LeftHandCold/matrixone/blob/578ff48a76f897dec56aecd97662b01b2efe1b30/docs/design/20261003-backup-gc-scan-proof.md), produced with gpt-6.1-sol / xhigh. Final overall review: gpt-6-astra / xhigh, PASS with no material blockers, bound to commit `578ff48a76f897dec56aecd97662b01b2efe1b30`. ### Validation macOS arm64, Go 1.26.4, branch-matched thirdparty artifacts and freshly built CGo: ```sh LC_ALL=C LANG=C GOMAXPROCS=4 .agents/skills/mo-dev/scripts/mo-cgo-test \ -p 2 -vet=all -count=1 -v -timeout=10m \ ./pkg/backup ./pkg/vm/engine/tae/logtail \ ./pkg/vm/engine/tae/db/gc/v3 ./pkg/datasync ``` All four packages and vet passed (15.280 / 1.009 / 0.823 / 16.822 seconds). Focused checks additionally cover: - Two actual backups, inherited GC metadata, historical checkpoint selection, and cache-disabled physical read returning `42`, for legacy and new metadata. - Real incremental and compacted producers, retained and genuinely reclaimed objects, owner/type/epoch sharing, timestamp boundaries and required missing files. - Real GC scan publication; row-read, metadata-write and cancellation failures; empty/nonempty metadata, gap merging, filtered checkpoint types, logical adjacency, invalid order and malformed proof. - Old block-zero reader behavior and partial checkpoint reads failing before `tae_list`/`tae_sum` publication. Small fixtures are shared; no service or large dataset is added. Historical exact-base/head evidence established the repeated-backup regression; current local checks establish the corrected behavior. Updated-head CI is pending. ### Cost and remaining limits Each GC window adds two timestamps; a trusted metadata rewrite adds one tiny block. Backup inspects candidate metadata and retains the existing selected-set and lifecycle maps. There is no new worker, cache, scheduler or snapshot policy, and no measured throughput claim. Legacy or gapped evidence remains conservative: an already missing old object can still cause backup failure when no trustworthy scan covers it. The change does not repair an incomplete backup already published. An old-version rewrite may discard the proof, making re-upgrade conservative; rolling back does not fix that old binary's unsafe selector. Customer-cluster full backup/restore and current/historical read acceptance have not been run. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28473.
What this PR does / why we need it:
Backup selects checkpoint object files before rewriting the special checkpoint to its
starttimestamp. A physical object may already be absent because it was logically deleted before that restored snapshot and then collected by normal GC. After #26290 correctly made missing checkpoint objects fail, attempting to copy such a historical object aborts the entire backup with error 20405.A
DropTSalone is not sufficient to omit an object. IfDropTS >= special checkpoint start, the checkpoint rewrite retains the object as live at the restored timestamp, and the physical file must remain in the copy set. This change selects from eachBackupObjectlifecycle timestamp:DropTS < restoreTS;DropTS == restoreTSorDropTS > restoreTS;This does not modify GC, checkpoint selection, backup protection, global-index de-duplication, checkpoint rewrite format, or restore metadata.
Design and validation
TestExecBackupKeepsObjectDeletedAfterRestoreTimestampusing a real special checkpoint withcreate=5/start=15/drop=30. It copies the non-appendable object, runs checkpoint rewrite, and verifies both the rewritten live metadata reference and the target physical object.TestSelectBackupObjectsOnlySkipsObjectsDeletedBeforeRestoreTimestamp, coveringDropTS <,==, and>restore timestamp.TestParallelCopyDataReturnsMissingSourceObjectas the negative control that a required missing source still returns 20405.pkg/backupfull package, andgo vet ./pkg/backuppassed atc06bdd547b.A distributed BVT is not added because this changes the internal TN checkpoint-object selection boundary. The owning package tests exercise the checkpoint loader, copy set, rewrite, and missing-source behavior deterministically.