diff --git a/patroni/__init__.py b/patroni/__init__.py index 85b6c5df..19ef4ac9 100644 --- a/patroni/__init__.py +++ b/patroni/__init__.py @@ -85,5 +85,5 @@ def main(): pass finally: patroni.api.shutdown() - patroni.postgresql.stop() + patroni.postgresql.stop(checkpoint=False) patroni.dcs.delete_leader() diff --git a/patroni/postgresql.py b/patroni/postgresql.py index df17200d..b3e2ab00 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -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