Re: log_checkpoints: count WAL segment creations from all processes - Mailing list pgsql-hackers

From Japin Li
Subject Re: log_checkpoints: count WAL segment creations from all processes
Date
Msg-id SY7PR01MB1092144EEC58DBDC5C306E972B648A@SY7PR01MB10921.ausprd01.prod.outlook.com
Whole thread Raw
In response to log_checkpoints: count WAL segment creations from all processes  (Xuneng Zhou <xunengzhou@gmail.com>)
Responses Re: log_checkpoints: count WAL segment creations from all processes
List pgsql-hackers
Hi, Xuneng

On Tue, 24 Mar 2026 at 19:17, Xuneng Zhou <xunengzhou@gmail.com> wrote:
> Hi Zsolt,
>
> On Tue, Mar 24, 2026 at 1:55 PM Zsolt Parragi <zsolt.parragi@percona.com> wrote:
>
>  Hello!
>
>  This is a simple patch, but shouldn't it include at least some basic
>  tests verifying the new behavior?
>
> Thanks for looking into this. I've added a test for it. Please take a look.

Thanks for updating the patch. A few comments on v2:

1.
+       (The probes listed next fire in sequence during checkpoint processing.)
+       arg0 is the number of buffers written. arg1 is the total number of

These changes seem unnecessary. Additionally, there appears to be an
indentation issue.

2.
+    current = pg_atomic_read_u64(&XLogCtl->walSegmentsCreated);
+    CheckpointStats.ckpt_segs_added = (int)
+        (current - XLogCtl->walSegsCreatedLastCheckpoint);
+    XLogCtl->walSegsCreatedLastCheckpoint = current;

Is integer overflow a concern here? It seems unlikely in practice.

>
> --
> Best,
> Xuneng
>
> [4. text/x-diff; v2-0001-Count-WAL-segment-creations-by-all-processes-in-l.patch]...

--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.



pgsql-hackers by date:

Previous
From: Yugo Nagata
Date:
Subject: Re: Allow to collect statistics on virtual generated columns
Next
From: David Geier
Date:
Subject: Re: Add pg_stat_vfdcache view for VFD cache statistics