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
This commit is contained in:
Alexander Kukushkin
2017-04-27 14:36:35 +02:00
committed by GitHub
parent 728a521c1d
commit 2263d68490
+3 -1
View File
@@ -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):