From 2263d68490457d13933873aa5d023f9687e68166 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Thu, 27 Apr 2017 14:36:35 +0200 Subject: [PATCH] bugfix: async executor was not set to busy when bootstrap without leader (#439) This was causing patroni to exit with following exception: 2017-04-27 08:54:25,000 CRITICAL: system ID mismatch, node foo-0 belongs to a different cluster: 6347967071236960319 != 2017-04-27 08:54:25,221 ERROR: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/patroni/__init__.py", line 134, in patroni_main patroni.run() File "/usr/local/lib/python3.5/dist-packages/patroni/__init__.py", line 110, in run logger.info(self.ha.run_cycle()) File "/usr/local/lib/python3.5/dist-packages/patroni/ha.py", line 946, in run_cycle info = self._run_cycle() File "/usr/local/lib/python3.5/dist-packages/patroni/ha.py", line 903, in _run_cycle sys.exit(1) SystemExit: 1 --- patroni/ha.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patroni/ha.py b/patroni/ha.py index 4939c73b..14645d74 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -165,8 +165,10 @@ class Ha(object): return 'failed to acquire initialize lock' else: if self.state_handler.can_create_replica_without_replication_connection(): + msg = 'bootstrap (without leader)' + self._async_executor.schedule(msg) self._async_executor.run_async(self.clone) - return "trying to bootstrap (without leader)" + return 'trying to ' + msg return 'waiting for leader to bootstrap' def recover(self):