close
Skip to content

fix(dataprotection): shorten restore-derived names on release-1.0#10266

Open
weicao wants to merge 1 commit into
release-1.0from
clara/restore-name-shorten-release-1.0
Open

fix(dataprotection): shorten restore-derived names on release-1.0#10266
weicao wants to merge 1 commit into
release-1.0from
clara/restore-name-shorten-release-1.0

Conversation

@weicao
Copy link
Copy Markdown
Contributor

@weicao weicao commented May 19, 2026

What problem does this fix?

OceanBase PITR restore on a temporary release-1.0 patch image hit a DataProtection Restore controller blocker before the engine restore path could run.

The prepareData Restore stayed Running, and Kubernetes rejected the generated prepareData Job because a derived volume name was longer than 63 characters:

dp-claim-tpl-workdir-ob-pitr-p5n2-main-n3-v3-restore-oceanbase-0

That name is built from:

dp-claim-tpl- + workdir + - + component + - + ordinal

For a valid long restore/component name, this can exceed the Kubernetes DNS label limit used by volume.name and volumeMount.name.

How this patch fixes it

This backports the main-branch fix from #10150 and adds the observed OceanBase case to the restore unit test.

  • Add a shared ShortenKubeName helper that keeps short names unchanged and shortens long names with a stable hash suffix.
  • Use it for restore-derived names, including prepareData Job volume / volumeMount names.
  • Keep the PVC claimName unchanged; only the Kubernetes volume / volumeMount name is shortened.
  • Ensure volume.name and volumeMount.name stay identical after shortening.

Evidence boundary

Primary runtime evidence is OceanBase PITR N=1 on a temporary patch image. This proves a release-1.0 DataProtection control-plane blocker for this long-name restore shape. It is not an OceanBase product verdict and not release-ready evidence.

Validation

Passed:

go test ./pkg/constant

Blocked by an existing release-1.0 generated mock gap, not by this patch:

go test ./pkg/dataprotection/restore -run 'TestBuildPVCVolumeAndMountShortensObservedOceanBasePrepareDataName|TestBuildPVCVolumeAndMountShortensDerivedVolumeName' -count=1

Error:

pkg/testutil/k8s/k8sclient_util.go:62:28: undefined: mock_client.MockClient
pkg/testutil/k8s/k8sclient_util.go:63:28: undefined: mock_client.MockStatusWriter

Runtime unlock still requires a refreshed temporary controller image and the same long-name OceanBase restore sample to pass. Static checks alone do not close the blocker.

@weicao weicao requested review from a team, ldming and wangyelei as code owners May 19, 2026 15:46
@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

@github-actions github-actions Bot added the size/L Denotes a PR that changes 100-499 lines. label May 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 60.52632% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.83%. Comparing base (2807dae) to head (c32ff95).

Files with missing lines Patch % Lines
pkg/constant/pattern.go 51.61% 10 Missing and 5 partials ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           release-1.0   #10266      +/-   ##
===============================================
+ Coverage        53.78%   53.83%   +0.05%     
===============================================
  Files              493      493              
  Lines            55343    55376      +33     
===============================================
+ Hits             29765    29813      +48     
+ Misses           22608    22585      -23     
- Partials          2970     2978       +8     
Flag Coverage Δ
unittests 53.83% <60.52%> (+0.05%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

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

Labels

size/L Denotes a PR that changes 100-499 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants