Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls
| От | Xuneng Zhou |
|---|---|
| Тема | Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls |
| Дата | |
| Msg-id | CABPTF7VSPGEM8MmZukqK_5_s8KU1W-fx+DrTG064BQgmMG2wBw@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls (Fujii Masao <masao.fujii@gmail.com>) |
| Ответы |
Re: Fix lag columns in pg_stat_replication not advancing when replay LSN stalls
|
| Список | pgsql-hackers |
Hi, On Wed, Oct 22, 2025 at 10:34 AM Fujii Masao <masao.fujii@gmail.com> wrote: > > On Tue, Oct 21, 2025 at 11:52 PM Xuneng Zhou <xunengzhou@gmail.com> wrote: > > The patch LGTM. > > Thanks for the review! > I've pushed the patch and backpatched it to all supported versions. > > > > I am wondering whether it is helpful to add some > > comments for this overflowed array > > Yes, do you have any specific suggestions? > How about something like: /* * Overflow entries for read heads that collide with the write head. * * When the cyclic buffer fills (write head is about to collide with a read * head), we save that read head's current sample here and mark it as using * overflow (read_heads[i] = -1). This allows the write head to continue * advancing while the overflowed mode continues lag computation using the * saved sample. * * Once the standby's reported LSN advances past the overflow entry's LSN, * we transition back to normal buffer-based tracking. */ > > and replacing literal zeros with the constant InvalidXLogRecPtr for > > better readability. > > > > /* InvalidXLogRecPtr means no overflow yet */ > > if (lag_tracker->overflowed[i].lsn == InvalidXLogRecPtr) > > I couldn't find any code like "lag_tracker->overflowed[i].lsn == 0", > so I'm not sure which part should be replaced with InvalidXLogRecPtr. > Could you point me to the exact location? > Sorry for the noise here, I mean if (lag_tracker->read_heads[head] == InvalidXLogRecPtr) before. But with this change, position 0 would be treated as overflow mode, which is clearly wrong... Best, Xuneng
В списке pgsql-hackers по дате отправления: