diff --git a/pglookout/pglookout.py b/pglookout/pglookout.py index 5e92e80..8d18c76 100755 --- a/pglookout/pglookout.py +++ b/pglookout/pglookout.py @@ -494,9 +494,11 @@ 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") + self.failover_decision_queue.get(timeout=self.missing_master_from_config_timeout) 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 @@ -664,7 +666,7 @@ def do_failover_decision(self, own_state, standby_nodes): int(total_amount_of_nodes), ) - if standby_nodes[furthest_along_instance] == own_state: + if furthest_along_instance == self.own_db: if self.check_for_maintenance_mode_file(): self.log.warning( "Canceling failover even though we were the node the furthest along, since " diff --git a/test/conftest.py b/test/conftest.py index 869ad7e..f7daf58 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -30,6 +30,7 @@ def pgl(): pgl_.cluster_monitor._connect_to_db = Mock() # pylint: disable=protected-access pgl_.create_alert_file = Mock() pgl_.execute_external_command = Mock() + pgl_.failover_decision_queue = Mock() try: yield pgl_ finally: