Repository navigation
fix: update patroni etcd hosts on host removal - #501
Merged
tsivaprasad merged 2 commits intoNov 4, 2026
Merged
Conversation
Up to standards ✅🟢 Issues
|
| Category | Results |
|---|---|
| Complexity | 1 medium |
🟢 Metrics 14 complexity · 3 duplication
Metric Results Complexity 14 Duplication 3
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
jason-lynch
approved these changes
Nov 4, 2026
tsivaprasad
deleted the
fix/PLAT-639/update-patroni-etcd-config-on-host-removal
branch
November 4, 2026 14:32
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
This PR fixes stale Patroni Etcd configuration after removing an Etcd server host from the cluster.
Previously, surviving database instances could continue referencing the removed Etcd server in their Patroni configuration. The host removal workflow now detects and rewrites stale Etcd configuration and updates all databases after the host has left the Etcd cluster.
Changes
PatroniConfig.Refreshcompares the Etcd hosts in the existingpatroni.yamlwith the current Etcd member list. On a mismatch itsets
etcd_hosts_outdated. The desired state never sets this flag, sothe planner sees a diff and runs
Update, which rewrites the configand reloads Patroni with SIGHUP. Because this is in
orchestrator/common, it covers both swarm and systemd, and anydatabase update now repairs a stale config.
RemoveHostworkflow now runs in this order:RemoveHostFromEtcdactivity).RemoveHostactivity now only doesthis).
remove-hosthandler now includes every modifiable database:their spec, as before.
creating)are skipped with a warning. Their next update fixes the config.
db.Variables(), which was previously left out.Testing
Verification:
db-awith instances on host-1, host-2 and host-3, anddb-bwith instances on host-1 and host-2 only.host-3Checklist
PLAT-639