Repository navigation
fix(backup): honor cancellation during object copy - #26289
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.
Deep-reviewed exact head fb2c31f against current main 42ba9fb.
The cancellation and ownership model is sound. The caller context now reaches both the scheduled job and every source/destination file operation; context-aware retry makes backoff interruptible. Admission is bounded by parallelism, a permanent error establishes the cancel cause before siblings unwind, and the caller joins every successfully submitted job before reading results or stopping the scheduler. This closes the old undersized errC blocked-send / post-return worker lifetime hazards while preserving the first causal error.
Local verification:
- caller cancellation, sibling cancellation, and retry-backoff cancellation passed individually under -race for 43/43/44 repetitions;
- existing backup CopyFileWithRetry and dependent datasync TestCopyFile passed under -race for 43/42 repetitions;
- the complete pkg/backup package passed under -race;
- vet, datasync regressions, diff checks, and a prospective merge with latest main passed;
- all current substantive GitHub CI checks are successful.
Non-blocking coordination: use Fixes #26246 so the issue closes automatically. PR #26290 changes the same scheduler block and test filename; whichever PR lands second must rebase and preserve both contracts: missing checkpoint objects are fatal, and caller cancellation remains end-to-end with joined workers. Also, the timeout cleanup in TestParallelCopyDataCancelsSiblingAfterCopyFailure would be more robust with a second bounded select instead of an unbounded <-result.
Merge Queue Status
This pull request spent 1 hour 53 minutes 3 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Requeued — the merge queue status continues in this comment ↓. |
fb2c31f to
fd6ea99
Compare
Merge Queue Status
This pull request spent 1 hour 10 minutes 7 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. 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 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: 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: 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?
Which issue(s) this PR fixes:
issue #26246
What this PR does / why we need it:
Current
mainalready contains #26290's bounded admission, first-error siblingcancellation, 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 retryhelper. Consequently, canceling
BackupDatacannot stop a blocked fileoperation or interrupt a retry delay.
This PR is intentionally limited to that remaining defect:
execBackupcaller context intoparallelCopyData;fix(backup): fail on missing checkpoint objects #26290's error and scheduling behavior;
DoWithRetryContextso caller or sibling cancellation interrupts retrybackoff;
during retry backoff.
Verification:
mainbecauseparallelCopyDatahas no caller-context path, and pass after the fix;-race -count=100;pkg/backup: full tests and full race tests;pkg/backup:go buildandgo vet;pkg/datasync.TestCopyFile.