Skip to content

fix: move connections on reload even when a replica is removed - #1522

Merged
jkaczman merged 2 commits into
mainfrom
jk-replica-removal
Sep 10, 2026
Merged

fix: move connections on reload even when a replica is removed#1522
jkaczman merged 2 commits into
mainfrom
jk-replica-removal

Conversation

@jkaczman

Copy link
Copy Markdown
Contributor

Previously, if a reload occurred, and if a replica was removed, all connections for all Pools (whether affiliated or not with the removed replica), would not be moved to the new Pools.

This is because Cluster::can_move_conns_to asserted that every existing Pool (address) must be present in the new configuration before attempting to move any.

To fix this,

  • I removed all the upfront has_compatible_address_with checks, and since LoadBalancer::move_conns_to already uses has_compatible_address_with itself, no further changes were needed there.
  • Additionally, I modified Address::compatible to account for database_number being different when a replica is removed.

Added a regression test for this. Removed some tests that asserted the old functionality.

Fixes https://github.com/pgdogdev/pgdog-enterprise/issues/615

@jkaczman
jkaczman requested a review from levkk September 10, 2026 20:40
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@levkk levkk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jkaczman
jkaczman merged commit f19923e into main Sep 10, 2026
29 checks passed
@jkaczman
jkaczman deleted the jk-replica-removal branch September 10, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants