Skip to content

fix(dataprotection): redirect postReady for multi-component restores - #10466

Merged
leon-ape merged 1 commit into
mainfrom
bugfix/dp-volumepopulator-pitr-postready-redirect
Jun 29, 2026
Merged

fix(dataprotection): redirect postReady for multi-component restores#10466
leon-ape merged 1 commit into
mainfrom
bugfix/dp-volumepopulator-pitr-postready-redirect

Conversation

@weicao

@weicao weicao commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #10418.

Summary

  • supersedes the controller-code portion of fix(dp): postReady-only redirect for multi-component logical backup restore #10423 with a clean controller-owned branch
  • redirects non-matching restore PVC postReady handling to the backup target component instead of silently completing it
  • keeps sharding missing-target skipPostReady as skip-only instead of treating every skip as redirectable
  • keeps the cluster-wide PVC bound wait and target-component NotFound requeue behavior from fix(dp): postReady-only redirect for multi-component logical backup restore #10423
  • fills redirected Restore ReadyConfig from the effective backup target so Strategy, required policy, and target volume mounts match the normal source-target path
  • adds regressions for the TiDB PITR prepareData+postReady shape, sharding skip-only behavior, and redirected postReady execution fields

Validation

  • PASS: go generate ./pkg/testutil/k8s/mocks (local compile prerequisite)
  • PASS: go test ./controllers/dataprotection -run 'TestEnsurePostReadyRestore_(ShardingMissingTargetSkip_DoesNotRedirect|MultiComponent_(PrepareDataAndPostReady_RedirectsPostReady|PostReadyOnly_ShouldNotSilentlySkip|PostReadyOnly_TargetComponentNotYetCreated|PostReadyOnly_WaitsForAllComponentPVCs|PostReadyOnly_TargetsSlice|PostReadyRedirectPreservesTargetExecutionFields))|TestDecidePVCRestore_MultiComponent_PostReadyOnly_SkipsNonMatchingPVC|TestDecidePVCRestoreAssignsShardingTargetsByStableComponentOrder|TestRebindPVCAndPV_NilPopulatePVC_ReturnsFatalError' -count=1
  • PASS: git diff --check -- controllers/dataprotection/volumepopulator_controller.go controllers/dataprotection/volumepopulator_controller_test.go
  • BLOCKED locally: go test ./controllers/dataprotection -count=1 cannot start envtest because /usr/local/kubebuilder/bin/etcd is absent; 0 envtest specs ran

Evidence boundary

TiDB PITR on PR1/idc4 reported 13P/1F/0S, with PITR.6 showing zero postReady Restore CRs on #10423 head 95b0723. This PR fixes the controller path and closes the local regression gate. A TiDB PITR runtime rerun against this PR head is still required for addon acceptance.

@weicao
weicao requested review from a team, ldming and wangyelei as code owners June 26, 2026 08:55
@apecloud-bot

Copy link
Copy Markdown
Collaborator

Auto Cherry-pick Instructions

Usage:
  - /nopick: Not auto cherry-pick when PR merged.
  - /pick: release-x.x [release-x.x]: Auto cherry-pick to the specified branch when PR merged.

Example:
  - /nopick
  - /pick release-1.1

CLA Recheck Instructions

Usage:
  - /recheck-cla: Trigger a re-check of CLA status for this pull request.
Example:
  - /recheck-cla

@github-actions github-actions Bot added the size/XL Denotes a PR that changes 500-999 lines. label Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.43165% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.16%. Comparing base (d8cbb03) to head (082f164).

Files with missing lines Patch % Lines
...llers/dataprotection/volumepopulator_controller.go 60.43% 38 Missing and 17 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10466      +/-   ##
==========================================
+ Coverage   62.10%   62.16%   +0.05%     
==========================================
  Files         533      533              
  Lines       63722    63839     +117     
==========================================
+ Hits        39577    39687     +110     
+ Misses      20547    20546       -1     
- Partials     3598     3606       +8     
Flag Coverage Δ
unittests 62.16% <60.43%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@weicao
weicao force-pushed the bugfix/dp-volumepopulator-pitr-postready-redirect branch from cd0622a to 4b36418 Compare June 26, 2026 09:11
@weicao weicao added the nopick Not auto cherry-pick when PR merged label Jun 26, 2026
Create the postReady Restore from the backup target component when a non-matching restore PVC is the trigger. Cover postReady-only logical restores and PITR prepareData+postReady restores so postReady is not treated as complete before the target-component Restore CR exists.
@weicao
weicao force-pushed the bugfix/dp-volumepopulator-pitr-postready-redirect branch from 4b36418 to 082f164 Compare June 26, 2026 09:59
@github-actions github-actions Bot added size/XXL Denotes a PR that changes 1000+ lines. and removed size/XL Denotes a PR that changes 500-999 lines. labels Jun 26, 2026
var target *dpv1alpha1.BackupStatusTarget
if backup.Status.Target != nil {
target = backup.Status.Target
} else if len(backup.Status.Targets) == 1 {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in 082f164. Sharding PVCs now resolve through the sharding order before the single-target selector fallback, and postReady redirect re-checks the sharding source-target result so missing-target shards stay skip-only instead of redirecting to the unique backup target. Added TestEnsurePostReadyRestore_ShardingSingleTargetMissingTargetSkip_DoesNotRedirect. Focused suite and TestDecidePVCRestore passed locally; CI is rerunning.

@apecloud-bot apecloud-bot added the approved PR Approved Test label Jun 29, 2026
@leon-ape leon-ape changed the title fix(dp): redirect postReady for multi-component restores chore(dp): redirect postReady for multi-component restores Jun 29, 2026
@leon-ape leon-ape changed the title chore(dp): redirect postReady for multi-component restores fix(dp): redirect postReady for multi-component restores Jun 29, 2026
@leon-ape leon-ape changed the title fix(dp): redirect postReady for multi-component restores fix(dataprotection): redirect postReady for multi-component restores Jun 29, 2026
@leon-ape
leon-ape merged commit f56092d into main Jun 29, 2026
42 checks passed
@leon-ape
leon-ape deleted the bugfix/dp-volumepopulator-pitr-postready-redirect branch June 29, 2026 04:16
@github-actions github-actions Bot added this to the Release 1.2.0 milestone Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved PR Approved Test nopick Not auto cherry-pick when PR merged size/XXL Denotes a PR that changes 1000+ lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VolumePopulator: skipPostReady blocks postReady restore for PVCs from non-backup-target components

3 participants