fix(dp): requeue volume populator wait states#10458
Conversation
When a backup ActionSet has only postReady (no prepareData/targetVolumes), decidePVCRestore incorrectly propagated skipPostReady=true for PVCs whose component did not match the backup target. This blocked the sole restore path for multi-component architectures like TiDB where the backup targets the SQL frontend but data lives in PD/TiKV PVCs. Override skipPostReady to false when restoreData is false: if there is no volume-level restore, PVC-selector mismatch should not block postReady. Fixes #10418
Address leon-ape's review: the previous fix `if !restoreData { skipPostReady = false }`
was too broad — in multi-component scenarios (e.g. TiDB with pd/tikv), non-target
component PVCs would also get skipPostReady cleared, potentially executing PostReady
restore on wrong components.
Refined approach: when !restoreData && skipPostReady, check if the PVC's component
label matches the backup target component. Only clear skipPostReady (and recover
sourceTarget) when the PVC belongs to the backup target component. Non-target
component PVCs keep skipPostReady=true.
… label When the backup target PodSelector exists but has no KBAppComponentLabelKey, targetMatchesComponent now returns false instead of true. This prevents the fallback from matching arbitrary component PVCs when we cannot confirm component membership. The no-PodSelector case (nil selector) still returns true -- that means the backup applies to all components by design.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10458 +/- ##
==========================================
+ Coverage 62.04% 62.05% +0.01%
==========================================
Files 533 533
Lines 63625 63707 +82
==========================================
+ Hits 39473 39535 +62
- Misses 20550 20565 +15
- Partials 3602 3607 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
22180f7 to
806bc35
Compare
|
Self-review outcome: the core change here is still the 1s requeue polling that was explicitly rejected twice on this same wait state (#10477, #10481 — the direction given was event-driven Pod watch + Job/PVC label mapping), and the by-design question raised by @wangyelei on #10477 ( |
Summary
This is a stacked follow-up on PR #10447.
It fixes two generic VolumePopulator retry/requeue gaps found during etcd restore validation:
handleSyncPVCErroreven when the target PVC already has the Populating condition, so controller-runtime can retry stale status/resource-version updatesPopulate()while prepareData jobs are not finished, so the controller does not depend on a later external PVC event after the restore container has exited and the restore-manager sidecar is still runningIt also carries two changes beyond the retry/requeue scope (called out explicitly for review):
decidePVCRestore: when no volume-level restore exists and the full target selector rejected the PVC (pod-only labels), clearskipPostReadyif the PVC's component matches the target's component selector, so the target component's PVCs still drive postReady for logical backups. Note the overlap with fix: match backup targets to restore PVC labels #10354, which fixes the selector matching itself — once fix: match backup targets to restore PVC labels #10354 merges, this fallback should become a no-op for the logical-backup case and can be re-evaluated.patchInternalRestoreStatus/patchInternalRestoreMetaAndStatus: re-read the latest Restore and apply only the fields this reconcile intended to change (original→desired delta onto latest), instead of merge-patching from a possibly stale base, to avoid clobbering concurrent Restore status writers.Validation
Focused unit tests:
Runtime validation on stacked head
943044aed667a71c2848da47c7b103920d6f6245:1.2.0-alpha.2, local-sideload DP imagekubeblocks-dataprotection:pr-10447-943044aed-20260626sha256:6744bc202b83d4e4314534adeb9a178307090334f0f00ddf1aef5538860fbf65Scope boundary
The runtime PASS above was run on the stacked combined head
943044aed, not on PR #10447 head alone.PR #10447 should remain the original restoreData/skipPostReady selector fix; this PR carries the follow-up generic VolumePopulator retry/requeue fixes.