Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls
Date
Msg-id CAHGQGwEbDGH=CY04r+55porPBC=9OR+wRJHV9AKsR3W_w=O7Bw@mail.gmail.com
Whole thread Raw
In response to Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls  (Shinya Kato <shinya11.kato@gmail.com>)
Responses Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls
List pgsql-hackers
On Mon, Oct 20, 2025 at 1:45 PM Shinya Kato <shinya11.kato@gmail.com> wrote:
>
> On Mon, Oct 20, 2025 at 10:17 AM Fujii Masao <masao.fujii@gmail.com> wrote:
> >
> > On Sun, Oct 19, 2025 at 2:04 AM Shinya Kato <shinya11.kato@gmail.com> wrote:
> > > Thank you for the patch. I have one comment.
> > >
> > > +       if (lag_tracker->overflowed[head].lsn > lsn)
> > > +           return now - lag_tracker->overflowed[head].time;
> > >
> > > Could this return a negative value if the clock somehow went
> > > backwards? The original code returns -1 in this case, so I'm curious
> > > about this.
> >
> > Thanks for the review!
> >
> > Yes, you're right. So I've updated the patch so that -1 is returned
> > when the current time is earlier than the time in the overflow entry,
> > treating it as "no new sample found".
>
> Thank you for updating the patch. It looks nice to me.

Thanks for the review!
Unless there are any objections, I'll commit the patch and
backpatch it to all supported branches.

Regards,

--
Fujii Masao



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array
Next
From: Sami Imseih
Date:
Subject: Re: Skip unregistered custom kinds on stats load