mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Set _need_rewind to True if the node was previously known as a master
This commit is contained in:
@@ -400,6 +400,7 @@ class Ha(object):
|
||||
'following new leader after trying and failing to obtain lock')
|
||||
else:
|
||||
# when we are doing manual failover there is no guaranty that new leader is ahead of any other node
|
||||
# node tagged as nofailover can be ahead of the new leader either, but it is always excluded from elections
|
||||
need_rewind = bool(self.cluster.failover) or self.patroni.nofailover
|
||||
if need_rewind:
|
||||
sleep(2) # Give a time to somebody to take the leader lock
|
||||
|
||||
@@ -774,6 +774,8 @@ class Postgresql(object):
|
||||
self._need_rewind = False
|
||||
if self.is_running():
|
||||
return
|
||||
elif change_role:
|
||||
self._need_rewind = True
|
||||
|
||||
self._need_rewind &= bool(leader and leader.conn_url) and self.can_rewind
|
||||
|
||||
|
||||
Reference in New Issue
Block a user