Обсуждение: [PATCH] Expose checkpoint reason to completion log messages.
Hi all,
This patch is an update after reworking the “checkpoint reason” changes as a standalone patch, separate from the pg_stat_checkpointer additions as suggested [1]. I applied the patch on a clean tree and verified that the logging changes work as expected under different workloads. I am attaching the observations and patch in support for this.This would improve clarity for performance debugging and help understand checkpoint behavior without parsing WAL logs manually. Below is one representative checkpoint log entry after a pgbench run and an explicit CHECKPOINT:
2025-12-01 15:33:30.121 IST [69178] LOG: checkpoint complete (immediate): wrote 3417 buffers (20.9%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 1 recycled; write=0.122 s, sync=0.022 s, total=0.166 s; sync files=9, longest=0.005 s, average=0.003 s; distance=31304 kB, estimate=489729 kB; lsn=0/65E92BC8, redo lsn=0/65E92B70
Regarding the pg_stat_checkpointer extensions [1], I understand the concerns that were raised and I will follow up with a separate full patch once I incorporate the remaining feedback.
Thank you for the guidance. It has been very helpful. Looking forward to more further feedback.
Regards,
Soumya
Reference
[1] https://www.postgresql.org/message-id/flat/CAMtXxw_W6w2Q1QsCvMPnoq3xCMKzH28Zjk_EmL60oP%2BsCTkXOw%40mail.gmail.com
This patch is an update after reworking the “checkpoint reason” changes as a standalone patch, separate from the pg_stat_checkpointer additions as suggested [1]. I applied the patch on a clean tree and verified that the logging changes work as expected under different workloads. I am attaching the observations and patch in support for this.This would improve clarity for performance debugging and help understand checkpoint behavior without parsing WAL logs manually. Below is one representative checkpoint log entry after a pgbench run and an explicit CHECKPOINT:
2025-12-01 15:33:30.121 IST [69178] LOG: checkpoint complete (immediate): wrote 3417 buffers (20.9%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 1 recycled; write=0.122 s, sync=0.022 s, total=0.166 s; sync files=9, longest=0.005 s, average=0.003 s; distance=31304 kB, estimate=489729 kB; lsn=0/65E92BC8, redo lsn=0/65E92B70
Regarding the pg_stat_checkpointer extensions [1], I understand the concerns that were raised and I will follow up with a separate full patch once I incorporate the remaining feedback.
Thank you for the guidance. It has been very helpful. Looking forward to more further feedback.
Regards,
Soumya
Reference
[1] https://www.postgresql.org/message-id/flat/CAMtXxw_W6w2Q1QsCvMPnoq3xCMKzH28Zjk_EmL60oP%2BsCTkXOw%40mail.gmail.com
Вложения
Hi, On 2025-12-01 16:48:56 +0530, Soumya S Murali wrote: > This patch is an update after reworking the “checkpoint reason” changes as > a standalone patch, separate from the pg_stat_checkpointer additions as > suggested [1]. This seems to not pass the tests on any platform: https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F6306 Looks like you need to update 019_replslot_limit.pl for the changed log format. I suggest running the tests before submitting. Greetings, Andres
Hi Andres, On Thu, Dec 18, 2025 at 5:49 AM Andres Freund <andres@anarazel.de> wrote: > > Hi, > > On 2025-12-01 16:48:56 +0530, Soumya S Murali wrote: > > This patch is an update after reworking the “checkpoint reason” changes as > > a standalone patch, separate from the pg_stat_checkpointer additions as > > suggested [1]. > > This seems to not pass the tests on any platform: > https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F6306 > > Looks like you need to update 019_replslot_limit.pl for the changed log > format. > > I suggest running the tests before submitting. > > Greetings, > > Andres Thank you for checking and for pointing this out. I will fix the expected log pattern, rerun the test, and will resend an updated patch once all tests get passed. Regards, Soumya
Hi all, On Thu, Dec 18, 2025 at 5:49 AM Andres Freund <andres@anarazel.de> wrote: > > Hi, > > On 2025-12-01 16:48:56 +0530, Soumya S Murali wrote: > > This patch is an update after reworking the “checkpoint reason” changes as > > a standalone patch, separate from the pg_stat_checkpointer additions as > > suggested [1]. > > This seems to not pass the tests on any platform: > https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F6306 > > Looks like you need to update 019_replslot_limit.pl for the changed log > format. > > I suggest running the tests before submitting. > > Greetings, > > Andres I have updated my patch and have tested successfully. Also had rerun the entire recovery TAP suite and every test got passed successfully. I am attaching the updated patch herewith. Regards, Soumya