Don't interrupt restart or promote if lost leader lock in pause (#1726)

In pause it is allowed to run postgres as master without lock.
This commit is contained in:
Alexander Kukushkin
2020-10-08 08:56:53 +02:00
committed by GitHub
parent 311e5ccc5b
commit e8e87bf0a1
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -1182,7 +1182,7 @@ class Ha(object):
return 'terminated crash recovery because of startup timeout'
return 'updated leader lock during ' + self._async_executor.scheduled_action
elif not self.state_handler.bootstrapping:
elif not self.state_handler.bootstrapping and not self.is_paused():
# Don't have lock, make sure we are not promoting or starting up a master in the background
if self._async_executor.scheduled_action == 'promote':
with self._async_response:
+3
View File
@@ -501,6 +501,9 @@ class TestHa(PostgresInit):
self.assertEqual(self.ha.run_cycle(), 'lost leader lock during restart')
mock_terminate.assert_called()
self.ha.is_paused = true
self.assertEqual(self.ha.run_cycle(), 'PAUSE: restart in progress')
def test_manual_failover_from_leader(self):
self.ha.fetch_node_status = get_node_status()
self.ha.has_lock = true