def timeline_wal_position(self) -> Tuple[int, int, Optional[int], Optional[int], Optional[int]]:
        """Get timeline and various wal positions.

        :returns: a tuple composed of 5 integers representing timeline, ``pg_current_wal_lsn()`` position
            on primary/the biggest value among receive and replay LSN on replicas, ``pg_control_checkpoint()``
            value on a standby leader, receive and replay LSN on replicas (if available).
        """
        # This method could be called from different threads (simultaneously with some other `_query` calls).
        # If it is called not from main thread we will create a new cursor to execute statement.
        if current_thread().ident == self.__thread_ident:
            timeline = self._cluster_info_state_get('timeline') or 0
            wal_position = self._cluster_info_state_get('wal_position') or 0
            replay_lsn = self.replay_lsn()
            receive_lsn = self.receive_lsn()
            pg_control_timeline = self._cluster_info_state_get('pg_control_timeline')
        else:
            timeline, wal_position, replay_lsn, receive_lsn, _, pg_control_timeline, _, write_location = \
                self._query(self.cluster_info_query)[0][:8]
            receive_lsn = max(receive_lsn or 0, write_location or 0)

        wal_position = self._wal_position(bool(timeline), wal_position, receive_lsn, replay_lsn)
        return timeline, wal_position, pg_control_timeline, receive_lsn, replay_lsn
Get timeline and various wal positions.

        :returns: a tuple composed of 5 integers representing timeline, ``pg_current_wal_lsn()`` position
            on primary/the biggest value among receive and replay LSN on replicas, ``pg_control_checkpoint()``
            value on a standby leader, receive and replay LSN on replicas (if available).
        
patroni/postgresql/__init__.py