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

From Shinya Kato
Subject Re: pg_stat_replication.*_lag sometimes shows NULL during active replication
Date
Msg-id CAOzEurSAvOf-vxzn9yQaCipgD6bSr4ncoTYjFceAPDO5fzMNNw@mail.gmail.com
Whole thread Raw
In response to Re: pg_stat_replication.*_lag sometimes shows NULL during active replication  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: pg_stat_replication.*_lag sometimes shows NULL during active replication
List pgsql-hackers
On Fri, Mar 20, 2026 at 2:13 AM Fujii Masao <masao.fujii@gmail.com> wrote:
> I think the issue occurs when the positions in the first message point to
> the same LSN (e.g., 0/030D5230), and the second message reports the same but
> larger LSN (e.g., 0/030D52E0).

Thanks for the explanation!

> I've updated the patch to address this. It removes fullyAppliedLastTime,
> tracks the positions from the previous reply, and clears the lag values only
> when the positions remain unchanged across two consecutive messages.
>
> Patch attached. Could you test and review this updated patch?

The patch works properly. I think it looks nice to me, except for the
typo I sent in the previous message.


--
Best regards,
Shinya Kato
NTT OSS Center



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: index prefetching
Next
From: Michael Paquier
Date:
Subject: Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE