mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
We should run checkpoint before shutdown all the time except one case
(when patroni is being shutdown)
This commit is contained in:
+1
-1
@@ -85,5 +85,5 @@ def main():
|
||||
pass
|
||||
finally:
|
||||
patroni.api.shutdown()
|
||||
patroni.postgresql.stop()
|
||||
patroni.postgresql.stop(checkpoint=False)
|
||||
patroni.dcs.delete_leader()
|
||||
|
||||
@@ -388,7 +388,7 @@ class Postgresql(object):
|
||||
except psycopg2.Error:
|
||||
logging.exception('Exception during CHECKPOINT')
|
||||
|
||||
def stop(self, mode='fast', block_callbacks=False):
|
||||
def stop(self, mode='fast', block_callbacks=False, checkpoint=True):
|
||||
# make sure we close all connections established against
|
||||
# the former node, otherwise, we might get a stalled one
|
||||
# after kill -9, which would report incorrect data to
|
||||
@@ -400,9 +400,10 @@ class Postgresql(object):
|
||||
self.set_state('stopped')
|
||||
return True
|
||||
|
||||
if block_callbacks:
|
||||
if checkpoint:
|
||||
self.checkpoint()
|
||||
else:
|
||||
|
||||
if not block_callbacks:
|
||||
self.set_state('stopping')
|
||||
|
||||
ret = subprocess.call(self._pg_ctl + ['stop', '-m', mode]) == 0
|
||||
|
||||
Reference in New Issue
Block a user