diff --git a/patroni/postgresql/rewind.py b/patroni/postgresql/rewind.py index 270d629c..6d8590ee 100644 --- a/patroni/postgresql/rewind.py +++ b/patroni/postgresql/rewind.py @@ -158,7 +158,7 @@ class Rewind(object): 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 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() else: # otherwise analyze pg_controldata output in_recovery, timeline, lsn = self._get_local_timeline_lsn_from_controldata() diff --git a/tests/test_rewind.py b/tests/test_rewind.py index f40c46af..108713f3 100644 --- a/tests/test_rewind.py +++ b/tests/test_rewind.py @@ -93,7 +93,7 @@ class TestRewind(BaseTestPostgresql): with patch.object(Postgresql, 'is_running', Mock(return_value=True)), \ patch.object(MockCursor, 'fetchone', - Mock(side_effect=[(0, 0, 1, 1, 0, 0, 0, 0, 0, None, None, None), Exception])): + Mock(side_effect=[Exception, (0, 0, 1, 1, 0, 0, 0, 0, 0, None, None, None)])): self.r.rewind_or_reinitialize_needed_and_possible(self.leader) @patch.object(CancellableSubprocess, 'call', mock_cancellable_call)