Skip to content

fix(backup): fail on missing checkpoint objects - #26290

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:agent/backup-missing-object-26247
Jul 28, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:agent/backup-missing-object-26247

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

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
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.

@LeftHandCold
LeftHandCold requested a review from XuPeng-SH as a code owner July 28, 2026 04:37
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

批准 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 均通过。

@mergify mergify Bot added the queued label Jul 28, 2026
@mergify

mergify Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-28 06:39 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-07-28 08:59 UTC · at 346ab792a5d7e0cd57842f34fd0e10b8788372db

This pull request spent 2 hours 20 minutes 17 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection] (documentation)
  • github-review-decision = APPROVED [🛡 GitHub branch protection] (documentation)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

Reason

Pull 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Failing checks:

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 1b6d430 into matrixorigin:main Jul 28, 2026
24 of 25 checks passed
@mergify mergify Bot added dequeued and removed queued labels Jul 28, 2026
XuPeng-SH pushed a commit that referenced this pull request Jul 28, 2026
## 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>
XuPeng-SH pushed a commit that referenced this pull request Sep 9, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## 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>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants