Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls
Date: 2025-10-20 01:12:07
Message-ID: CAHGQGwE3Juv75LxWSwHL5UmYQAoWKE1tot06XSSQArOh=b4O5A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 18, 2025 at 9:16 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-10-20 01:17:21 Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls
Previous Message Michael Paquier 2025-10-20 01:02:31 Re: [PATCH] Fix POSIX compliance in pgwin32_unsetenv()