mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
DCS.write_leader_optime() should update /status key (#2064)
This moment was forgotten in the failover logical slots implementation.
This commit is contained in:
@@ -774,8 +774,7 @@ class AbstractDCS(object):
|
||||
:returns: `!True` on success."""
|
||||
|
||||
def write_leader_optime(self, last_lsn):
|
||||
if self._last_lsn != last_lsn and self._write_leader_optime(last_lsn):
|
||||
self._last_lsn = last_lsn
|
||||
self.write_status({self._OPTIME: last_lsn})
|
||||
|
||||
@abc.abstractmethod
|
||||
def _write_status(self, value):
|
||||
@@ -789,7 +788,8 @@ class AbstractDCS(object):
|
||||
self._last_status = value
|
||||
cluster = self.cluster
|
||||
min_version = cluster and cluster.min_version
|
||||
if min_version and min_version < (2, 1, 0):
|
||||
if min_version and min_version < (2, 1, 0) and self._last_lsn != value[self._OPTIME]:
|
||||
self._last_lsn = value[self._OPTIME]
|
||||
self._write_leader_optime(str(value[self._OPTIME]))
|
||||
|
||||
@abc.abstractmethod
|
||||
@@ -890,7 +890,7 @@ class AbstractDCS(object):
|
||||
:param last_lsn: latest checkpoint location in bytes"""
|
||||
|
||||
if last_lsn:
|
||||
self.write_leader_optime(last_lsn)
|
||||
self.write_status({self._OPTIME: last_lsn})
|
||||
return self._delete_leader()
|
||||
|
||||
@abc.abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user