Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPq0U-0014O9-1t for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2026 23:07:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wPq0S-008hdh-1n for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2026 23:07:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPq0S-008hdY-0s for pgsql-hackers@lists.postgresql.org; Wed, 20 May 2026 23:07:17 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wPq0R-000000000mA-0wiD for pgsql-hackers@postgresql.org; Wed, 20 May 2026 23:07:16 +0000 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-36608b2f2dcso3340676a91.2 for ; Wed, 20 May 2026 16:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779318434; x=1779923234; darn=postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=IW4imR1i2+MokizbZ/BS6EdiHZJrPb7WgG7mAzTM3JA=; b=Fa8qS5J9n7pMLFlBoc5ojo9yrOcpYZrEaJAhn9ZkC4byDwn2n+HfW1u3LO3OKHYHiX f9h5wYarqNtk+Lr7+nfWM5HrzV22yvQIYgEcgZgcBAaSW6boGfTnCMMcstg18EJgF6D+ mxJLRswWL1zizjJMSBGteWplN1DquYSThSqcVvFr9QSFrIoEy/hzwRgwEKIOYdrE4oYq 70UBaGxTXvlEcnhyE+wJQlQXmCDz6iZNYSv93g4ovW6GGUmV5QBq5//oX+Wdla1ZtNXf lXZCP9vbpLG3CVJlFehRgcIa8OTqAspSbSNSfF5ixGknn3TisD3nahJ1YIoVx/tQFJJW QJLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779318434; x=1779923234; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IW4imR1i2+MokizbZ/BS6EdiHZJrPb7WgG7mAzTM3JA=; b=YoKR8UvLF83UFEmDRm0u0zrtEt8km4u3Unpdl4lFZSwJpF2HLXG+7f9zWpjn9DfZ3O C1GWONzkC379k93tDUSQzCCnFxrvVVB6jxjlkjqBxGYJx/WwppjvuqtUVXiqn7XU5fMw pZki+Ct3PbzOo/XgyjFdV3apeIJltW9ejyjbkt6KI5oq49vG0fNyiaGUSZEAlcBiyavW 0v/yC/ZhIM0dH5yLihqiDYougqroHuFv9+bKY4PMjUrrDEY0XhgNC1AKoulIzUPIDA+9 EJA/JYfy7obd5nUXya+E8EEswHOPvX1po73+1hg1PDhpgStMhRmkmyxR8WVR5pIgi6RD Or2w== X-Gm-Message-State: AOJu0YzyP9QPdOWywRbbG3xjF1OkhePDYvdjvZYfH3KDYpjPTJmw88xQ 4RSndNkYPvEulhYrFKz+9ftfVF9GSpYTwv6jD3nsm/EmPGk0xTR2mW22 X-Gm-Gg: Acq92OHQrBCjKalwUtAWvQcASizPHKPnyNvZ0RnSXbVWTEOzLfuEsvAxoFPeDKNijwa 7YQH1ePtkrP7tRWusztFcgw1stTOpfzx0h+j2N1fZGhzlJdKUayX4DCpZmLBN9/OdEihptiyvBE v93fphcjoxHRfydD2yI5q6uingUYibgyOCXFeokgEgFFhxHgQNM/lNf9QeTLkDZylryf/27Uu1N Nv9faBLvuDALGZIPqVhH412xe1sUywW3I8JMukOAbEbJFzcrUXk/pYbWbh+8zwyn4hIMld5mTWn aLK82ZlmiBBbD3geY37W7w6K6y2l9kh5jEYZDc5ZRlQpF78ZmFPXyiSRamFgdh6KlKhXHU7x1LY ar+siv0Y4/VGyDdxBhzYKrxoy+bg/nLgAVC+fG9Hp/dr/bDo5Yw3V1A7Y84ucsDpdyxGFTCwbj4 ePVwBQbT8kg22GEpUJATeEZC8i2Z65BRA= X-Received: by 2002:a17:902:da92:b0:2ba:3e50:e3f5 with SMTP id d9443c01a7336-2bea30a6324mr1703565ad.30.1779318434097; Wed, 20 May 2026 16:07:14 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5cfe49a4sm212781475ad.38.2026.05.20.16.07.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2026 16:07:13 -0700 (PDT) From: Chao Li Message-Id: <1B695040-F544-447C-A6A8-C8BFF7F799D1@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_85D81BDF-5576-421C-B45D-28217D850339" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: Fix pg_stat_wal_receiver to show CONNECTING status Date: Thu, 21 May 2026 07:06:33 +0800 In-Reply-To: Cc: PostgreSQL-development , Michael Paquier , Xuneng Zhou To: Michael Paquier References: <1F153E64-B791-42FA-A60A-64813B20B81E@gmail.com> <75CDE990-29D5-4D5C-BFE1-3840F19C0163@gmail.com> X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_85D81BDF-5576-421C-B45D-28217D850339 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 21, 2026, at 04:43, Michael Paquier = wrote: >=20 > On Wed, May 20, 2026 at 03:53:38PM +0800, Chao Li wrote: >> 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. >>=20 >> But I think it might be useful to show the *_lsn and *_tli values in >> CONNECTING state if they are available. >=20 > The original reason why ready_to_display has been introduced is this > one, where we wanted to have a strict control over the connection > information across multiple calls of pg_stat_get_wal_receiver(): > = https://www.postgresql.org/message-id/CAB7nPqQNbHQ7F7wDD_2qvGA_FUW-Leds9HQ= NM6kJnto7RFNhUg@mail.gmail.com >=20 > With v2, ready_to_display is still able to do the job it is defined > for. This does not need to apply on the time fields, so IMO showing > them to the values they are initialized is not a big deal, and they > can actually be useful to know even in the early stage of connection > as they reveal the state of the code. =20 >=20 > Note also that the time values could still show up based on their > initial values at the early connection stage, even after completing > walrcv_connect() and after ready_to_display is switched to true, so > it's not like these values are that confusing: we just expose them a > bit more at an earlier stage of the connection attempt process. As a > whole v2 is fine, and addresses your issue. > -- > Michael Thanks for the detailed explanation. Now I see that, based on the original discussion you pointed out, as = long as v2 clears conninfo before setting ready_to_display to true, it = is okay to do that earlier while the state is still CONNECTING. On that = point, I=E2=80=99m good with v2. I=E2=80=99m still not fully convinced about displaying the *_time = fields, but I don=E2=80=99t have a stronger argument either, so I=E2=80=99= m fine with that. Maybe we can add a brief description in the doc like = the attached diff? Overall, v2 looks good to me now. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ --Apple-Mail=_85D81BDF-5576-421C-B45D-28217D850339 Content-Disposition: attachment; filename=nocfbot_monitoring.sgml.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="nocfbot_monitoring.sgml.diff" Content-Transfer-Encoding: 7bit diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 08d5b824552..d2c8d547a91 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1743,6 +1743,12 @@ description | Waiting for a newly initialized WAL file to reach durable storage connected server. + + When the WAL receiver is in connecting state, the time + fields in this view may reflect their initial values rather than values + received from the WAL sender. + + <structname>pg_stat_wal_receiver</structname> View --Apple-Mail=_85D81BDF-5576-421C-B45D-28217D850339--