Re: Add last commit LSN to pg_last_committed_xact()

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Add last commit LSN to pg_last_committed_xact()
Дата
Msg-id 202201172134.ftvqmoyewxkg@alvherre.pgsql
обсуждение исходный текст
Ответ на Add last commit LSN to pg_last_committed_xact()  (James Coleman <jtc331@gmail.com>)
Ответы Re: Add last commit LSN to pg_last_committed_xact()  (Robert Haas <robertmhaas@gmail.com>)
Re: Add last commit LSN to pg_last_committed_xact()  (James Coleman <jtc331@gmail.com>)
Re: Add last commit LSN to pg_last_committed_xact()  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On 2022-Jan-14, James Coleman wrote:

> The logical slot can't flush past the
> last commit, so even if there's 100s of megabytes of unflushed WAL on
> the slot there may be zero lag (in terms of what's possible to
> process).
>
> I've attached a simple patch (sans tests and documentation) to get
> feedback early. After poking around this afternoon it seemed to me
> that the simplest approach was to hook into the commit timestamps
> infrastructure and store the commit's XLogRecPtr in the cache of the
> most recent value (but of course don't write it out to disk).

Maybe it would work to have a single LSN in shared memory, as an atomic
variable, which uses monotonic advance[1] to be updated.  Whether this is
updated or not would depend on a new GUC, maybe track_latest_commit_lsn.
Causing performance pain during transaction commit is not great, but at
least this way it shouldn't be *too* a large hit.

[1] part of a large patch at
https://www.postgresql.org/message-id/202111222156.xmo2yji5ifi2%40alvherre.pgsql

-- 
Álvaro Herrera              Valdivia, Chile  —  https://www.EnterpriseDB.com/
"Find a bug in a program, and fix it, and the program will work today.
Show the program how to find and fix a bug, and the program
will work forever" (Oliver Silfridge)



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations
Следующее
От: Tom Lane
Дата:
Сообщение: Re: a misbehavior of partition row movement (?)