Fix bug in the bootstrap standby-leader (#2144)

When starting postgres after bootstrap of the standby-leader the `follow()` method is used to always return `True`.
This behavior was changed in the #2054 in order to avoid hammering logs if postgres is failing to start.

Since now the method returns `None` if postgres didn't start accepting connections after 60s, the change broke the standby-leader bootstrap code.

As the solution, we will assume that the clone was successful if the `follow()` method returned anything different from `False`.
This commit is contained in:
Alexander Kukushkin
2021-12-21 11:20:06 +01:00
committed by GitHub
parent 63586f0477
commit d2b681b07e
+1 -1
View File
@@ -241,7 +241,7 @@ class Ha(object):
logger.info('bootstrapped %s', msg)
cluster = self.dcs.get_cluster()
node_to_follow = self._get_node_to_follow(cluster)
return self.state_handler.follow(node_to_follow)
return self.state_handler.follow(node_to_follow) is not False
else:
logger.error('failed to bootstrap %s', msg)
self.state_handler.remove_data_directory()