Re: tracking commit timestamps

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: tracking commit timestamps
Дата
Msg-id CA+U5nMKezHt0aesvBAW6kGWs7upSfz5zCedxtSy50j-KSoZprA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: tracking commit timestamps  (Fujii Masao <masao.fujii@gmail.com>)
Ответы Re: tracking commit timestamps  (Petr Jelinek <petr@2ndquadrant.com>)
Список pgsql-hackers
On 25 November 2014 at 13:35, Fujii Masao <masao.fujii@gmail.com> wrote:

> Can I check my understanding? Probably we cannot use this feature to calculate
> the actual replication lag by, for example, comparing the result of
> pg_last_committed_xact() in the master and that of
> pg_last_xact_replay_timestamp()
> in the standby. Because pg_last_xact_replay_timestamp() can return even
> the timestamp of aborted transaction, but pg_last_committed_xact()
> cannot. Right?

It was intended for that, but I forgot that
pg_last_xact_replay_timestamp() includes abort as well.

I suggest we add a function that returns both the xid and timestamp on
the standby:
* pg_last_commit_replay_info() - which returns both the xid and
timestamp of the last commit replayed on standby
* then we use the xid from the standby to lookup the commit timestamp
on the master.
We then have two timestamps that refer to the same xid and can
subtract to give us an exact replication lag.

That can be done manually by user if requested.

We can also do that by sending the replay info back as a feedback
message from standby to master, so the information can be calculated
by pg_stat_replication when requested.

I'll work on that once we have this current patch committed.

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Christoph Berg
Дата:
Сообщение: PITR failing to stop before DROP DATABASE
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: tracking commit timestamps