Re: pg_stat_replication.*_lag sometimes shows NULL during active replication - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: pg_stat_replication.*_lag sometimes shows NULL during active replication
Date
Msg-id CAHGQGwHLK5ObQShRx15OwBK4whO7MQ0VXveBtxDsMiibGUGK_g@mail.gmail.com
Whole thread
In response to Re: pg_stat_replication.*_lag sometimes shows NULL during active replication  (Shinya Kato <shinya11.kato@gmail.com>)
Responses Re: pg_stat_replication.*_lag sometimes shows NULL during active replication
List pgsql-hackers
On Wed, Mar 25, 2026 at 4:03 PM Shinya Kato <shinya11.kato@gmail.com> wrote:
> Thanks for the updated patch. LGTM.
>
> Regarding the backpatch, I'd personally appreciate it if the walsender.c changes were backpatched to stable branches.
Asyou noted, it don't fully solve the reported issue, but they do help reduce the cases where lag columns in
pg_stat_replicationunexpectedly become NULL. 
>
> Even a partial mitigation in the back branches would be valuable for users running stable releases.

+1

I've split the changes into two patches.

Patch 0001 fixes premature NULL lag reporting in walsender. I will commit it
and backpatch it to all supported branches.

Patch 0002 avoids sending duplicate WAL locations in standby status replies.
I will commit this to master only.

Regards,

--
Fujii Masao

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pg_stat_replication.*_lag sometimes shows NULL during active replication
Next
From: Melanie Plageman
Date:
Subject: Re: Don't synchronously wait for already-in-progress IO in read stream