mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Fix bug with priority failover (#3297)
We should ignor the former leader with higher priority when it reports the same LSN as the current node. This bug could be a contributing factor to issues described in #3295 In addition to that mock socket.getaddrinfo() call in test_api.py to avoid hitting DNS servers.
This commit is contained in:
@@ -1076,6 +1076,9 @@ class TestHa(PostgresInit):
|
||||
# if there is a higher-priority node but it has a lower WAL position then this node should race
|
||||
self.ha.fetch_node_status = get_node_status(failover_priority=6, wal_position=9)
|
||||
self.assertTrue(self.ha._is_healthiest_node(self.ha.old_cluster.members))
|
||||
# if the old leader is a higher-priority node on the same WAL position then this node should race
|
||||
self.ha.fetch_node_status = get_node_status(failover_priority=6)
|
||||
self.assertTrue(self.ha._is_healthiest_node(self.ha.old_cluster.members, leader=self.ha.old_cluster.leader))
|
||||
self.ha.fetch_node_status = get_node_status(wal_position=11) # accessible, in_recovery, wal position ahead
|
||||
self.assertFalse(self.ha._is_healthiest_node(self.ha.old_cluster.members))
|
||||
# in synchronous_mode consider itself healthy if the former leader is accessible in read-only and ahead of us
|
||||
|
||||
Reference in New Issue
Block a user