Re: Add wal_fpi_bytes_[un]compressed to pg_stat_wal

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Add wal_fpi_bytes_[un]compressed to pg_stat_wal
Дата
Msg-id aQC_VKjVuaqnlc-c@paquier.xyz
обсуждение исходный текст
Ответ на Re: Add wal_fpi_bytes_[un]compressed to pg_stat_wal  (Shinya Kato <shinya11.kato@gmail.com>)
Ответы Re: Add wal_fpi_bytes_[un]compressed to pg_stat_wal
Список pgsql-hackers
On Tue, Oct 28, 2025 at 07:33:00PM +0900, Shinya Kato wrote:
> I investigated previous discussions and found [0]. This thread
> mentioned that XLogInsert() calls XLogRecordAssemble() multiple times
> in its do-while loop, so the value might be invalid.
>
> Based on the discussion above, it seems my previous patch also has the
> same issue.
>
> [0] https://www.postgresql.org/message-id/20200329121944.GA79261%40nol

Dammit, you are right.  I didn't see through this one.  Even on HEAD
it is true that we may trigger an early exit of XLogInsertRecord() and
call XLogRecordAssemble() multiple times with a different FPI setup.
So we cannot do direct manipulations of pgWalUsage in
XLogRecordAssemble(), we must do these once the record is inserted.

I'll clean up that tomorrow, which can be summarized as something like
the attached (quick fix, need to double-check).
--
Michael

Вложения

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