Skip to content

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

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

fix(dataprotection): preserve OneToOne source Pod identity during scale-out restore#10837
leon-ape merged 1 commit into
release-1.0from
bugfix/1.0-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.0. 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 instanceset.ParseParentNameAndOrdinal, which is the workload name parser available on 1.0.

Release adaptation

This is an independent release-1.0 port rather than an automatic cherry-pick. This branch uses the annotation-based restore API, the older instance-template label, and does not contain the newer instancetemplate package or the 1.1 source-target override.

Validation

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

  • ./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/L Denotes a PR that changes 100-499 lines. label Sep 1, 2026
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.52174% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.29%. Comparing base (1d97fb1) to head (33fbe87).

Files with missing lines Patch % Lines
pkg/dataprotection/restore/utils.go 52.17% 22 Missing and 11 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.0   #10837      +/-   ##
===============================================
+ Coverage        54.14%   54.29%   +0.14%     
===============================================
  Files              495      495              
  Lines            55950    56053     +103     
===============================================
+ Hits             30296    30434     +138     
+ Misses           22647    22602      -45     
- Partials          3007     3017      +10     
Flag Coverage Δ
unittests 54.29% <56.52%> (+0.14%) ⬆️

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 bf642ca into release-1.0 Sep 1, 2026
33 of 34 checks passed
@leon-ape
leon-ape deleted the bugfix/1.0-scaleout-restore-one-to-one-ordinal branch September 1, 2026 03:35
@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/L Denotes a PR that changes 100-499 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