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 CAHGQGwE3Juv75LxWSwHL5UmYQAoWKE1tot06XSSQArOh=b4O5A@mail.gmail.com
Whole thread Raw
In response to Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls
List pgsql-hackers
On Sat, Oct 18, 2025 at 9:16 AM Chao Li <li.evan.chao@gmail.com> wrote:
> I think I put all concentration on the big picture yesterday, so I ignored this implementation detail:
>
> ```
> +               if (lag_tracker->overflowed[head].lsn > lsn)
> +                       return now - lag_tracker->overflowed[head].time;
> ```
>
> Should this “>” be “>=“?

I think either ">" or ">=" would work. However, the following loop
in LagTrackerRead() advances the read head when the LSN
in the current buffer entry is equal to the given LSN, so I followed
the same logic for the overflow entry and used ">" there.

Regards,

--
Fujii Masao



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [PATCH] Fix POSIX compliance in pgwin32_unsetenv()
Next
From: Fujii Masao
Date:
Subject: Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls