Skip to content

fix(dataprotection): preserve OneToOne source Pod identity during scale-out restore - #10836

Merged
leon-ape merged 1 commit into
release-1.1from
bugfix/1.1-scaleout-restore-one-to-one-ordinal
Sep 1, 2026
Merged

fix(dataprotection): preserve OneToOne source Pod identity during scale-out restore#10836
leon-ape merged 1 commit into
release-1.1from
bugfix/1.1-scaleout-restore-one-to-one-ordinal

Conversation

@leon-ape

@leon-ape leon-ape commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Backport of #10826 for release-1.1. Related to #10828.

Problem

Scale-out creates one Restore per new Pod. The Restore currently replaces the actual Pod ordinal with the start of its instance-template range, and DP later treats BackupStatusTarget.SelectedTargetPods as an ordinal-indexed array. Kubernetes list order does not provide that contract, so reversed lists, ordinal holes, and multiple templates sharing the same ordinal can select the wrong source Pod or produce an empty restore.

What changed

  • Preserve the actual scale-out Pod ordinal when building each per-Pod Restore.
  • Resolve OneToOne source Pods by exact workload/template/ordinal identity rather than list position.
  • Preserve positional behavior for generic claims-template Restores without KubeBlocks Pod identity labels.
  • Apply the same identity mapping to snapshot PVCs and prepare-data Jobs.
  • Reuse the workload Pod-name parser for exact template extraction.
  • Clarify that RestoreManager.SourceTargetName is a prepareData/scale-out override.

Release adaptation

This is an independent release-1.1 port rather than an automatic cherry-pick because the restore manager, tests, and Ops source-target support differ from main.

Validation

Passed with the repository test wrapper (using the current generated mock overlay because the release branch's generated mock file is incomplete):

  • ./pkg/controller/instancetemplate
  • ./pkg/dataprotection/restore
  • ./pkg/controller/plan
  • ./pkg/operations
  • git diff --check

@leon-ape
leon-ape requested review from a team, ldming and wangyelei as code owners September 1, 2026 02:24
@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 Sep 1, 2026
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.33058% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.63%. Comparing base (86f6a87) to head (b43dea6).

Files with missing lines Patch % Lines
pkg/dataprotection/restore/utils.go 49.18% 21 Missing and 10 partials ⚠️
pkg/dataprotection/restore/manager.go 59.45% 12 Missing and 3 partials ⚠️
pkg/controller/plan/restore.go 75.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           release-1.1   #10836      +/-   ##
===============================================
+ Coverage        55.57%   55.63%   +0.06%     
===============================================
  Files              550      550              
  Lines            62332    62421      +89     
===============================================
+ Hits             34639    34727      +88     
+ Misses           24388    24380       -8     
- Partials          3305     3314       +9     
Flag Coverage Δ
unittests 55.63% <60.33%> (+0.06%) ⬆️

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.

@leon-ape leon-ape added the nopick Not auto cherry-pick when PR merged label Sep 1, 2026
@leon-ape leon-ape linked an issue Sep 1, 2026 that may be closed by this pull request
@leon-ape
leon-ape merged commit 619a34a into release-1.1 Sep 1, 2026
32 of 33 checks passed
@leon-ape
leon-ape deleted the bugfix/1.1-scaleout-restore-one-to-one-ordinal branch September 1, 2026 03:34
@github-actions github-actions Bot added this to the Release 1.2.0 milestone Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nopick Not auto cherry-pick when PR merged size/XL Denotes a PR that changes 500-999 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OneToOne scale-out restore maps source Pods by list position

2 participants