public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Michael Paquier <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Xuneng Zhou <[email protected]>
Subject: Re: Fix pg_stat_wal_receiver to show CONNECTING status
Date: Wed, 20 May 2026 15:53:38 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>



> On May 20, 2026, at 12:10, Michael Paquier <[email protected]> wrote:
> 
> On Wed, May 20, 2026 at 09:47:40AM +0800, Chao Li wrote:
>> I just read v2, and it is actually the first solution I tried. The
>> reason I gave up on that approach and switched to the implementation
>> in v1 is that it may wrongly report last_msg_send_time,
>> last_msg_receipt_time, and latest_end_time.
> 
> As of the code, we have the following at the top of WalReceiverMain()
> before the first connection attempt:
>    /* Initialise to a sanish value */
>    now = GetCurrentTimestamp();
>    walrcv->lastMsgSendTime =
>       walrcv->lastMsgReceiptTime = walrcv->latestWalEndTime = now;
> 

Was that okay because walrcv->ready_to_display was false, so the sane initial value would not show up through pg_stat_wal_receiver?

> And the state of v2 is actually fine, because we finish by reporting
> in the SQL calls values that represent the state the WAL receiver is 
> initialized at based on what the code does.  It would be IMO an issue
> to hide this information, as they can offer hits about the moment when
> we've begun a connection.
> --
> Michael

With v2, slot_name, sender_host, sender_port, and conninfo are already left NULL while the receiver is in CONNECTING state. I feel we don't have to show the timestamp fields either. Since the columns are named last_msg_send_time and last_msg_receipt_time, users may naturally interpret them as the last time a message was sent to or received from
the primary. If we show the standby server start time in those columns, I am afraid that could be confusing.

But I think it might be useful to show the *_lsn and *_tli values in CONNECTING state if they are available.

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










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: Fix pg_stat_wal_receiver to show CONNECTING status
  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