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 1wPbl2-000tFr-1a for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2026 07:54:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wPbl0-006kN7-1J for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2026 07:54:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPbl0-006kMe-0N for pgsql-hackers@lists.postgresql.org; Wed, 20 May 2026 07:54:23 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wPbky-00000000W1B-3yK1 for pgsql-hackers@postgresql.org; Wed, 20 May 2026 07:54:22 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2ba17c8cfacso43271115ad.2 for ; Wed, 20 May 2026 00:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779263658; x=1779868458; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2R1rdGUr0eyqWxLW4BvQYxNCmxpl8uCT1kwgeFHVu9A=; b=EoX78Nd88v6ECHjamxy22ZdDxghg6l0rQoXjT4HfPVBhVIr/sTb/MGh6oFMwL/lfB0 t8n64RwNflDv7LmCQpz0Tvwuc8yMsu8AbNZlCG9kgdJWyvRBJvGX6pKlIA7QLi4gB//0 1IibPrDi9e7q6W+XEIjMK2TBCOrFhKdzdb0mry41UfH3l44FMXpJjFgsUzYTZoxZ87hR JZTbtOACv/GESZ2anRbXz33Vs+n+hx8FKxrMHSq78ACAOxeyLVqEeT7O/GVbLdUdTYMq iy7ZpjuW2u+FAmfA65hytyhhNnEFbSMG5X5doXDBxoPBSx0xci4MOgtx77omiejchy8X 7mwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779263658; x=1779868458; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2R1rdGUr0eyqWxLW4BvQYxNCmxpl8uCT1kwgeFHVu9A=; b=aC0BM/45vqFvGz6VciXu42FQGL6NL0QucnLf2JNYCa0cm5+LQ6vwO3RMUgrQr7Zxvv x1A0L4VvlpMrQiLDzWknxUE+3EP04+LOhhqMQ/ZDdmi+XZ5owefaw1xdICBNEBC8IO1x uO3rn297nK/9n794DKY2MxYZjDxXtMS66P5ifif2jqU3hwwbwAnKHhx4ddmZJV+A6YbK 1Z5sZQYKyoJ68GCsnI8yJeHmrhl/6Lj/YxJk05Osh5vcq4OwHGMzdlLbhVH0/3OqfmA8 YGIkpMniJnN/+QUDBNLGqqWVnL0jFbL0ii6c2pc4HqcnVGt8RLIHr4ijz59mzVlghOFd x42A== X-Gm-Message-State: AOJu0YwPgRrj523wLdXzswVL6UZv2OwFeIdGfz2Iz6NcuslWkfdwIBGG IEdo918VJWXp26lrrTunGlvM2ZHQN7Yb+Fd9nm3QqpCeusmSnLbvR79aRuK9T6r5rKM= X-Gm-Gg: Acq92OH8u5NBSZVRkWmhenXf+uBVZXq1frzMX1MwyV0WrozPsSvgLPDYbX8ajrk7b1k 31gIjqp4cjYSelOOwcxu58doOGNzrt+zilb0EUXyQlmm8cWCYKQHdY6t2N1M4uoi979MNo86h5Q Bc/eoSPsTpzIbPXYrbpjsoC4kEeL1N7tf07WkAu3I3sk1o/1LOE13QU5v4jrjV8NyjUpjyD6rEA bXx72Np3Xy+y8ZXb5urfVf2mOxb3dqDzdWWPXSag0tmiNs5yatO7ZS72jJuah+srlCi5Y+xzcrq 8oiBVwc2FjNb5Y9cOuMUyZj8ZnjmdjvOAdKNXxqxy4xDvrWwoQBsL4ogC9R7zA8JKOPUjXhuVld zskXYCrC6lvXA3DbksmPJvkwCzZ/Dema7JyOj5ln7+8IYGRlyB6pWJ7tj1PGLBZXd6txAoFWdAy AGd6npoet1Je04kBxLzL6b6O5CuldBLsw= X-Received: by 2002:a17:903:24f:b0:2ae:ce35:2686 with SMTP id d9443c01a7336-2bd7e7f9404mr254393785ad.5.1779263658304; Wed, 20 May 2026 00:54:18 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5d235c18sm197551835ad.81.2026.05.20.00.54.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2026 00:54:17 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Fix pg_stat_wal_receiver to show CONNECTING status From: Chao Li In-Reply-To: Date: Wed, 20 May 2026 15:53:38 +0800 Cc: PostgreSQL-development , Michael Paquier , Xuneng Zhou Content-Transfer-Encoding: quoted-printable Message-Id: <75CDE990-29D5-4D5C-BFE1-3840F19C0163@gmail.com> References: <1F153E64-B791-42FA-A60A-64813B20B81E@gmail.com> To: Michael Paquier X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On May 20, 2026, at 12:10, Michael Paquier = wrote: >=20 > 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. >=20 > As of the code, we have the following at the top of WalReceiverMain() > before the first connection attempt: > /* Initialise to a sanish value */ > now =3D GetCurrentTimestamp(); > walrcv->lastMsgSendTime =3D > walrcv->lastMsgReceiptTime =3D walrcv->latestWalEndTime =3D now; >=20 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=20= > 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/