Skip to content

Commit

Permalink
Actually refresh the standby_nodes from the newly acquired state
Browse files Browse the repository at this point in the history
  • Loading branch information
rdunklau committed Apr 10, 2024
1 parent b6e5150 commit 5ea3daa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pglookout/pglookout.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,17 @@ def consider_failover(self, own_state, master_node, standby_nodes):
self.log.warning("Not considering failover, because it's not enabled by configuration")
elif self.current_master:
self.cluster_monitor_check_queue.put("Master is missing, ask for immediate state check")
# Refresh the standby nodes list, and check that we still don't have a master node
self.failover_decision_queue.get(timeout=self.missing_master_from_config_timeout)
cluster_state = copy.deepcopy(self.cluster_state)
observer_state = copy.deepcopy(self.observer_state)
master_instance, master_node, standby_nodes = self.create_node_map(cluster_state, observer_state)
# We seem to have a master node after all
if master_node and master_node.get("connection"):
return
master_known_to_be_gone = self.current_master in self.known_gone_nodes
now = time.monotonic()
config_timeout_exceeded = (now - self.cluster_nodes_change_time) >= self.missing_master_from_config_timeout

if master_known_to_be_gone or config_timeout_exceeded:
# we've seen a master at some point in time, but now it's
# not reachable or removed from configuration, perform an
Expand Down

0 comments on commit 5ea3daa

Please sign in to comment.