mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Avoid stopping pg instance when in paused state
This commit is contained in:
+4
-1
@@ -128,5 +128,8 @@ def main():
|
||||
pass
|
||||
finally:
|
||||
patroni.api.shutdown()
|
||||
patroni.postgresql.stop(checkpoint=False)
|
||||
if patroni.ha.is_paused():
|
||||
logger.info('Postgres is not stopped due paused state')
|
||||
else:
|
||||
patroni.postgresql.stop(checkpoint=False)
|
||||
patroni.dcs.delete_leader()
|
||||
|
||||
+3
-2
@@ -26,6 +26,9 @@ class Ha(object):
|
||||
self.recovering = False
|
||||
self._async_executor = AsyncExecutor()
|
||||
|
||||
def is_paused(self):
|
||||
return self.cluster.config and 'pause' in self.cluster.config.data and self.cluster.config.data['pause']
|
||||
|
||||
def load_cluster_from_dcs(self):
|
||||
cluster = self.dcs.get_cluster()
|
||||
|
||||
@@ -150,8 +153,6 @@ class Ha(object):
|
||||
if self.state_handler.is_leader() or self.state_handler.role == 'master':
|
||||
return message
|
||||
else:
|
||||
if self.cluster.config and 'pause' in self.cluster.config.data and self.cluster.config.data['pause']:
|
||||
return "Not promoted due to paused state."
|
||||
self.state_handler.promote()
|
||||
self.touch_member()
|
||||
return promote_message
|
||||
|
||||
Reference in New Issue
Block a user