public inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Chao Li <li.evan.chao@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Xuneng Zhou <xunengzhou@gmail.com>
Subject: Re: Fix pg_stat_wal_receiver to show CONNECTING status
Date: Wed, 20 May 2026 13:10:33 +0900
Message-ID: <ag00OeH1sbt5ie_6@paquier.xyz> (raw)
In-Reply-To: <1F153E64-B791-42FA-A60A-64813B20B81E@gmail.com>
References: <EF91FF76-1E2B-4F3B-9162-290B4DC517FF@gmail.com>
	<agxr29Hsz7FjxzlN@paquier.xyz>
	<1F153E64-B791-42FA-A60A-64813B20B81E@gmail.com>

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;

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


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

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: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, li.evan.chao@gmail.com, michael.paquier@gmail.com, xunengzhou@gmail.com
  Subject: Re: Fix pg_stat_wal_receiver to show CONNECTING status
  In-Reply-To: <ag00OeH1sbt5ie_6@paquier.xyz>

* 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