fix(shard): always orphan PVCs on scale-down instead of hard-deleting - #663
Open
niconosenzo wants to merge 1 commit into
Open
niconosenzo wants to merge 1 commit into
niconosenzo wants to merge 1 commit into
Conversation
niconosenzo
force-pushed
the
switch-PVC-to-soft-deletes
branch
2 times, most recently
from
September 18, 2026 09:33
4e91204 to
bf11e9c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
niconosenzo
force-pushed
the
switch-PVC-to-soft-deletes
branch
2 times, most recently
from
September 18, 2026 11:47
08569be to
a8a3a05
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
niconosenzo
force-pushed
the
switch-PVC-to-soft-deletes
branch
from
September 18, 2026 13:08
a8a3a05 to
15a2c6c
Compare
This comment has been minimized.
This comment has been minimized.
Always orphan instead and let multigres-gc reclaim after the retention window, except when the owning MultigresCluster is being deleted, where there is nothing left to roll back to. Signed-off-by: Nicolas Nosenzo <niconosenzo@gmail.com>
niconosenzo
force-pushed
the
switch-PVC-to-soft-deletes
branch
from
September 18, 2026 13:18
15a2c6c to
7bd0400
Compare
niconosenzo
marked this pull request as ready for review
September 18, 2026 13:19
🔬 Go Test Coverage ReportSummary
Status✅ PASS DetailShow New Coverage |
Verolop
reviewed
Sep 18, 2026
| } | ||
| cluster := &multigresv1alpha1.MultigresCluster{} | ||
| err := r.Get(ctx, client.ObjectKey{Namespace: namespace, Name: clusterName}, cluster) | ||
| if errors.IsNotFound(err) { |
Contributor
There was a problem hiding this comment.
I think the cluster controller drops its finalizer before the shards finish cleaning up. If the cluster is already gone by the time we get here, we’ll get NotFound and orphan the PVCs anyway. We can orphan here too unless you want to make the cluster wait for shard cleanup.
I tested this by running the cluster deletion reconciliation before shard cleanup. The parent disappeared, and the PVC remained with an orphan timestamp and no owner references.
Verolop
approved these changes
Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes the replica-count threshold that decided between orphaning a PVC (deferred deletion via multigres-gc) and hard-deleting it in-line during pool scale-down and shard removal.
Now: PVC cleanup during scale-down/drain/replace/shard-removal always orphans, unconditionally. The only case that still hard-deletes in-line is when the owning MultigresCluster itself is being deleted, at that point there's nothing to roll a scale-down back to, so there's no reason to wait out the retention window.
Changes
pvcOrphanReplicasThreshold/orphanByRemainingCount(the hard-delete-past-threshold logic) from shard_controller.go.