public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Fujii Masao <[email protected]>
Cc: Shinya Kato <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: pg_stat_replication.*_lag sometimes shows NULL during active replication
Date: Tue, 24 Mar 2026 13:32:00 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHGQGwGRLOYj95OfQ5T+mJYmyQ8YrvQ1SNOkiviV+5aWT1iCoA@mail.gmail.com>
References: <CAOzEurTzcUrEzrH97DD7+Yz=HGPU81kzWQonKZvqBwYhx2G9_A@mail.gmail.com>
	<CAHGQGwE=kyQ+YnGPn8zpZ959+3ywg8OR_Nu__uXxxuE0E+Y_Zg@mail.gmail.com>
	<CAOzEurRGiGE2Dfe+ySpb=+93ku=7ZC6RgAbHtLC6Xsq3g2XexA@mail.gmail.com>
	<CAHGQGwH2h_R7FWPvEs3+NWLwHZoj9r96tUyRKi5haqxMc6FXiQ@mail.gmail.com>
	<CAOzEurQiP3uebd1GMiC1Dzf5VJwF4ZBEpJ6QYQFE6Y+rVjxqNA@mail.gmail.com>
	<CAHGQGwEmMBBAE0RG-R3_LacfT4fbB55qGE6n9O5mNwrqvbNBtw@mail.gmail.com>
	<CAOzEurRF+OWcMZpfE=NV_Wcm6CFFGOnuxC6L9WWCjOMN0_eZMQ@mail.gmail.com>
	<CAHGQGwGPg20Rw2PydBDXiKHgn55s--E14-qRy7t3M+DHreCJww@mail.gmail.com>
	<CAOzEurSDzFsRXjofhq7mbNgoL8HaVbNeEhWBm7m9_K2ZNQnaBw@mail.gmail.com>
	<CAHGQGwFzg9J_z71kwnjXOxaoO3upMW8RdT4ieE8MBLq6h-ojZg@mail.gmail.com>
	<CAOzEurRV117N2neo1N_O+xWPv=-R7qou+i7k-h79JjTP9sO1Fg@mail.gmail.com>
	<CAHGQGwGLUXmjC1+A1fzg-ynP1pdKC-0yfmLYcnnu4YJSEDnuQw@mail.gmail.com>
	<CAOzEurSAvOf-vxzn9yQaCipgD6bSr4ncoTYjFceAPDO5fzMNNw@mail.gmail.com>
	<CAHGQGwGRLOYj95OfQ5T+mJYmyQ8YrvQ1SNOkiviV+5aWT1iCoA@mail.gmail.com>



> On Mar 23, 2026, at 23:31, Fujii Masao <[email protected]> wrote:
> 
> On Sat, Mar 21, 2026 at 11:05 AM Shinya Kato <[email protected]> wrote:
>> 
>> On Fri, Mar 20, 2026 at 2:13 AM Fujii Masao <[email protected]> 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.
> 
> Thanks for the review!
> 
> I've fixed the typo and attached an updated patch. I also incorporated
> Chao's comments from upthread. I'm planning to commit this to master.
> 
> As for backpatching, I'm hesitant to backpatch the full patch since it may
> reduce the number of replication feedback messages, which feels too invasive
> for stable branches.
> 
> That said, the patch's changes in walsender.c could be backpatched.
> As discussed earlier, they don't fully address the reported issue,
> but they do help mitigate cases where lag becomes NULL unexpectedly
> in logical replication. So it might be worth considering those changes
> for stable branches.
> 
> Thoughts?
> 
> Regards,
> 
> -- 
> Fujii Masao
> <v6-0001-Avoid-sending-duplicate-WAL-locations-in-standby-.patch>

Thank you for updating the patch. I saw that the variable name and function name were changed to reflect my earlier comments.

v6 looks good to me.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/









view thread (21+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pg_stat_replication.*_lag sometimes shows NULL during active replication
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox