refactor(shard): remove dormant DRAINED stand-in machinery - #570
Draft
mkindahl wants to merge 1 commit into
Draft
Conversation
This comment has been minimized.
This comment has been minimized.
Quarantine remediation (delete pod + wipe data PVC + re-bootstrap from backup) supersedes the older "stand-in replica" model, in which a pod whose topology role was DRAINED was kept alive for investigation while a replacement replica was provisioned at a higher index. With the quarantine path in place, nothing ever sets the DRAINED role anymore, so that machinery was dead code. Remove it: - countDrainedPods and the effectiveReplicas = replicas + drainedCount computation; createMissingResources and handleScaleDown now operate on the user-desired replica count directly. - syncDrainedLabels and the multigres.com/role (LabelPodRole) label it maintained, plus the DRAINED branch in cleanupDrainedPod that orphaned a pod's PVC unconditionally. - the DRAINED short-circuits in isDrainStale and isPoolHealthy (isPoolHealthy still excludes QUARANTINED pods). No behavior change for live paths: rolling updates, scale-down, and quarantine remediation are unaffected. Tests that exercised the removed stand-in behavior are deleted or refolded onto the index-vs-replicas semantics that remain. Part of MUL-1009. Signed-off-by: Mats Kindahl <mats.kindahl@supabase.io>
mkindahl
force-pushed
the
refactor/remove-drained-standin
branch
from
August 14, 2026 12:33
75e787c to
656025b
Compare
🔬 Go Test Coverage ReportSummary
Status✅ PASS DetailShow New Coverage |
mkindahl
marked this pull request as draft
August 17, 2026 06:11
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.
Summary
Follow-up cleanup that removes the now-dormant DRAINED stand-in machinery. Quarantine remediation (#568) supersedes it: a pooler whose PostgreSQL is unrecoverable is now marked
QUARANTINEDand the operator wipes + re-bootstraps the pod in place, rather than keeping the bad pod alive and provisioning a stand-in replica at a higher index. With that path in place, nothing ever sets theDRAINEDtopology role anymore, so all the code that reacted to it is dead.What's removed
countDrainedPodsand theeffectiveReplicas = replicas + drainedCountcomputation.createMissingResourcesandhandleScaleDownnow operate on the user-desired replica count directly.syncDrainedLabelsand themultigres.com/role(LabelPodRole) label it maintained, plus theDRAINEDbranch incleanupDrainedPodthat unconditionally orphaned a pod's PVC.DRAINEDshort-circuits inisDrainStaleandisPoolHealthy.isPoolHealthystill excludesQUARANTINEDpods (which are expected to be unhealthy while remediation replaces them).No behavior change for live paths
Rolling updates, scale-down, and quarantine remediation are all unaffected —
DRAINEDwas never produced once quarantine landed. Tests that exercised the removed stand-in behavior are deleted (TestDrainedPodReplacement, thesyncDrainedLabelserror case) or refolded onto the index-vs-replicas semantics that remain (TestCleanupDrainedPod_PVCDeletion,TestHandleScaleDown_ConcurrentDrainPrevention, theisPoolHealthy/isDrainStalecases).Part of MUL-1009.