mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Don't rely on pg_stat_wal_receiver when deciding on pg_rewind (#2863)
As was reported by @ants on Slack it could happen that `received_tli` is ahead of replayed timeline, therefore we should stop using it when deciding on pg_rewind if postgres is running and use only `IDENTIFY_SYSTEM` via replication connection.
This commit is contained in:
@@ -158,7 +158,7 @@ class Rewind(object):
|
|||||||
def _get_local_timeline_lsn(self) -> Tuple[Optional[bool], Optional[int], Optional[int]]:
|
def _get_local_timeline_lsn(self) -> Tuple[Optional[bool], Optional[int], Optional[int]]:
|
||||||
if self._postgresql.is_running(): # if postgres is running - get timeline from replication connection
|
if self._postgresql.is_running(): # if postgres is running - get timeline from replication connection
|
||||||
in_recovery = True
|
in_recovery = True
|
||||||
timeline = self._postgresql.received_timeline() or self._postgresql.get_replica_timeline()
|
timeline = self._postgresql.get_replica_timeline()
|
||||||
lsn = self._postgresql.replayed_location()
|
lsn = self._postgresql.replayed_location()
|
||||||
else: # otherwise analyze pg_controldata output
|
else: # otherwise analyze pg_controldata output
|
||||||
in_recovery, timeline, lsn = self._get_local_timeline_lsn_from_controldata()
|
in_recovery, timeline, lsn = self._get_local_timeline_lsn_from_controldata()
|
||||||
|
|||||||
Reference in New Issue
Block a user