Repository navigation
fix(backup): fail on missing checkpoint objects - #26290
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
批准 exact head cdbd28b6cd23ca690aadce1e0126610ce5bd4480。
修复闭环正确:checkpoint 列出的 object 缺失不再计为成功 skip,而是通过 cancel cause 保留并返回首个真实复制错误;admission 始终受 parallelism 约束,首错后不再补充新 job;所有已提交 job 都通过唯一 completion 信号被收齐并 WaitDone,之后才向上返回,因此不会重现旧 errC 的多发送者阻塞、活跃 worker 上关闭 channel 或后台污染。execBackup 在该错误处直接返回,不会继续写成功的 tae_list。
Q1-Q3 审计未发现新的泄漏、double cleanup、wait-for cycle 或错误覆盖。三个回归分别按 30 秒预算执行 -race 45/45/43 次通过;pkg/backup 完整 race、依赖 pkg/datasync.TestCopyFile race、vet 和编译通过。基于 latest main 的虚拟合并无冲突,diff --check 与 GitHub substantive CI 均通过。
Merge Queue Status
This pull request spent 2 hours 20 minutes 17 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26290 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.
Failing checks:
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: issue #26246 ## What this PR does / why we need it: Current `main` already contains #26290's bounded admission, first-error sibling cancellation, joining of scheduled jobs, and missing-object failure semantics. The remaining bug is that backup object-copy jobs derive their context from `context.Background()`, and retry backoff uses the non-context-aware retry helper. Consequently, canceling `BackupData` cannot stop a blocked file operation or interrupt a retry delay. This PR is intentionally limited to that remaining defect: - pass the `execBackup` caller context into `parallelCopyData`; - derive the existing cancel-cause context from the caller while preserving #26290's error and scheduling behavior; - use `DoWithRetryContext` so caller or sibling cancellation interrupts retry backoff; - add deterministic regressions for cancellation during a blocked read and during retry backoff. Verification: - focused cancellation regressions fail to compile on current `main` because `parallelCopyData` has no caller-context path, and pass after the fix; - focused cancellation/concurrency tests: `-race -count=100`; - `pkg/backup`: full tests and full race tests; - `pkg/backup`: `go build` and `go vet`; - dependent `pkg/datasync.TestCopyFile`. 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 #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 #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: issue matrixorigin#26247 ## What this PR does / why we need it: A checkpoint-listed object is part of the backup's consistency boundary. Treating `ErrFileNotFound` as a successful skip lets `tae_list` omit a referenced object while the overall backup reports success. This change: - returns every object-copy error, including `ErrFileNotFound`, to the backup caller; - bounds admission to the configured parallelism, cancels sibling copies on the first error, stops admitting new objects, and joins every submitted job before returning the original failure; - removes the one-slot worker error channel, so promoting missing objects to errors cannot leave concurrent senders blocked or close their channel while workers are active; - adds regressions for the missing-object result, stopping admission after a permanent error, and waiting for already-submitted siblings. Verification: - focused regression red on current main, green after the fix; - `pkg/backup` full tests and full race tests; - focused race stress for each regression with `-count=100`; - `go build` and `go vet` for `pkg/backup`; - dependent `pkg/datasync.TestCopyFile`. 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: issue matrixorigin#26246 ## What this PR does / why we need it: Current `main` already contains matrixorigin#26290's bounded admission, first-error sibling cancellation, joining of scheduled jobs, and missing-object failure semantics. The remaining bug is that backup object-copy jobs derive their context from `context.Background()`, and retry backoff uses the non-context-aware retry helper. Consequently, canceling `BackupData` cannot stop a blocked file operation or interrupt a retry delay. This PR is intentionally limited to that remaining defect: - pass the `execBackup` caller context into `parallelCopyData`; - derive the existing cancel-cause context from the caller while preserving matrixorigin#26290's error and scheduling behavior; - use `DoWithRetryContext` so caller or sibling cancellation interrupts retry backoff; - add deterministic regressions for cancellation during a blocked read and during retry backoff. Verification: - focused cancellation regressions fail to compile on current `main` because `parallelCopyData` has no caller-context path, and pass after the fix; - focused cancellation/concurrency tests: `-race -count=100`; - `pkg/backup`: full tests and full race tests; - `pkg/backup`: `go build` and `go vet`; - dependent `pkg/datasync.TestCopyFile`. 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: issue matrixorigin#26247 ## What this PR does / why we need it: A checkpoint-listed object is part of the backup's consistency boundary. Treating `ErrFileNotFound` as a successful skip lets `tae_list` omit a referenced object while the overall backup reports success. This change: - returns every object-copy error, including `ErrFileNotFound`, to the backup caller; - bounds admission to the configured parallelism, cancels sibling copies on the first error, stops admitting new objects, and joins every submitted job before returning the original failure; - removes the one-slot worker error channel, so promoting missing objects to errors cannot leave concurrent senders blocked or close their channel while workers are active; - adds regressions for the missing-object result, stopping admission after a permanent error, and waiting for already-submitted siblings. Verification: - focused regression red on current main, green after the fix; - `pkg/backup` full tests and full race tests; - focused race stress for each regression with `-count=100`; - `go build` and `go vet` for `pkg/backup`; - dependent `pkg/datasync.TestCopyFile`. 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: issue matrixorigin#26246 ## What this PR does / why we need it: Current `main` already contains matrixorigin#26290's bounded admission, first-error sibling cancellation, joining of scheduled jobs, and missing-object failure semantics. The remaining bug is that backup object-copy jobs derive their context from `context.Background()`, and retry backoff uses the non-context-aware retry helper. Consequently, canceling `BackupData` cannot stop a blocked file operation or interrupt a retry delay. This PR is intentionally limited to that remaining defect: - pass the `execBackup` caller context into `parallelCopyData`; - derive the existing cancel-cause context from the caller while preserving matrixorigin#26290's error and scheduling behavior; - use `DoWithRetryContext` so caller or sibling cancellation interrupts retry backoff; - add deterministic regressions for cancellation during a blocked read and during retry backoff. Verification: - focused cancellation regressions fail to compile on current `main` because `parallelCopyData` has no caller-context path, and pass after the fix; - focused cancellation/concurrency tests: `-race -count=100`; - `pkg/backup`: full tests and full race tests; - `pkg/backup`: `go build` and `go vet`; - dependent `pkg/datasync.TestCopyFile`. 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: issue matrixorigin#26247 ## What this PR does / why we need it: A checkpoint-listed object is part of the backup's consistency boundary. Treating `ErrFileNotFound` as a successful skip lets `tae_list` omit a referenced object while the overall backup reports success. This change: - returns every object-copy error, including `ErrFileNotFound`, to the backup caller; - bounds admission to the configured parallelism, cancels sibling copies on the first error, stops admitting new objects, and joins every submitted job before returning the original failure; - removes the one-slot worker error channel, so promoting missing objects to errors cannot leave concurrent senders blocked or close their channel while workers are active; - adds regressions for the missing-object result, stopping admission after a permanent error, and waiting for already-submitted siblings. Verification: - focused regression red on current main, green after the fix; - `pkg/backup` full tests and full race tests; - focused race stress for each regression with `-count=100`; - `go build` and `go vet` for `pkg/backup`; - dependent `pkg/datasync.TestCopyFile`. 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: issue matrixorigin#26246 ## What this PR does / why we need it: Current `main` already contains matrixorigin#26290's bounded admission, first-error sibling cancellation, joining of scheduled jobs, and missing-object failure semantics. The remaining bug is that backup object-copy jobs derive their context from `context.Background()`, and retry backoff uses the non-context-aware retry helper. Consequently, canceling `BackupData` cannot stop a blocked file operation or interrupt a retry delay. This PR is intentionally limited to that remaining defect: - pass the `execBackup` caller context into `parallelCopyData`; - derive the existing cancel-cause context from the caller while preserving matrixorigin#26290's error and scheduling behavior; - use `DoWithRetryContext` so caller or sibling cancellation interrupts retry backoff; - add deterministic regressions for cancellation during a blocked read and during retry backoff. Verification: - focused cancellation regressions fail to compile on current `main` because `parallelCopyData` has no caller-context path, and pass after the fix; - focused cancellation/concurrency tests: `-race -count=100`; - `pkg/backup`: full tests and full race tests; - `pkg/backup`: `go build` and `go vet`; - dependent `pkg/datasync.TestCopyFile`. 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?
Which issue(s) this PR fixes:
issue #26247
What this PR does / why we need it:
A checkpoint-listed object is part of the backup's consistency boundary. Treating
ErrFileNotFoundas a successful skip letstae_listomit a referenced objectwhile the overall backup reports success.
This change:
ErrFileNotFound, to the backupcaller;
first error, stops admitting new objects, and joins every submitted job before
returning the original failure;
errors cannot leave concurrent senders blocked or close their channel while
workers are active;
permanent error, and waiting for already-submitted siblings.
Verification:
pkg/backupfull tests and full race tests;-count=100;go buildandgo vetforpkg/backup;pkg/datasync.TestCopyFile.