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 1w5dSf-003SqK-2B for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 05:40:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5dSe-0019gT-0a for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 05:40:52 +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 1w5dSd-0019gK-2T for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 05:40:52 +0000 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5dSc-000000015jr-1Qm7 for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 05:40:51 +0000 Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-8d00cf835b7so84252885a.1 for ; Wed, 25 Mar 2026 22:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774503649; cv=none; d=google.com; s=arc-20240605; b=HqldSkg6SOwW+bIzeEwlQfSAANo417t/3qlxnrswqgqHOaTbXaGSAgJ0fQ94SLFSv+ WwtluN0Y+DfsZHALZweYOBtJHxQfVKlFLkBiG0wytMLnrF8I5hakAeEJh0Rx3+Yaq5pn Mj9+qVrxaVwX9eEOISYWMIGZAzemE643JO66wyf7uKMvzpq2Nftl/wosT87/azQtVlSH 5F9uWJirv4HsB5R+2NDulbyckbvn2BrkBqoDdvRQiICNn0rX2GuY3Ni2DmwvB/EIqI9s 70oEH8SGgFKZyGP9NU/lekRlN2KU8cPyq0kXJ2IxUw8uauVPf8egQf4HN2algtPY+C/0 2j/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=LQ38qNnr53xtvB9cFURseYiC63+lJNzhpeCv55nh0cY=; fh=x4xgi4tdDukVB0fBuAIe3vORvD36rbbTBlhrrGN8QbM=; b=EIBwLB/8Uqk7Ew436fVIeoFSlVmJ3ug9D6RT71QMRKwNb4uRCOzgtW+B5NzHbHVbpO BvoCG8b5cX1O/MtdnZKBd4JuD0Nw8bKenOCjYb8PhBDHY3VFe6EDjfur2rkrei4Icy9G DBhgYWHB65KmOktuqhE6rZQyJpnd40i5XcsCWyYWtwze7G/iCmbvCj67PxZESkrwKRHx 3xKNzEIgD9Smau/pr/gqqT9HkdQ/+HoFBw5iL8jxPQj9zDqojdZ2weUkf3jEjH0sakEh CTMKJDN2eGEP9GGXyscK5MTsKcp+basOzxnUiHYtE24nFEarQEFQl1lYmqAQMZc1mFqs 5SUg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774503649; x=1775108449; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LQ38qNnr53xtvB9cFURseYiC63+lJNzhpeCv55nh0cY=; b=GgIG+9NPS+7z+LBZqRuemx1KG3hJflYvbx+0hrbop3NlJBzsj5iwjWHfy1Kfgp40/Z PzIL5s8VRdf1a+2zZxWgic6nWd2Aoy5m0Lo+BrTML+LiNuijtQraiJNDPAXZ6uHFKhq7 EBKflLewuEjBDRXIcgoEj1oSCcDyU/PXFVdRHFGKx9D1wA2Jwr1+MsobiFsVk47qsTPc okbIELPueV+91J69upPESL2p+bq55bTIzKX8QG9I7oc300ajnpGT2fKIvKK2pnt9snGT vBGTGqy+W6N5XjH1LgVezVRBg3/SlSK0hNAZwBm3fiBFYsJ+VodzYtEVWM8iWpotuuko EVvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774503649; x=1775108449; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LQ38qNnr53xtvB9cFURseYiC63+lJNzhpeCv55nh0cY=; b=XyKTlcQr1qklmNZnAJwTaw3SBqcltkkjSaQ9dbhHAfRhWAZOcOrPRCH4y8Pt6SK5gP lm7ToKNQqeGIiFj1AW0n3WjKVwWL/Ms1BuZmVINliTf9nagUX9YQaHUTCTsdpqNXWU9N uuQM9Jr1UJYeJCDCUDdgc0Phjvyeb2RXYs/hp/0qKRZbcH5xVuvUXH9gMD3pY9LEpMJN vdpfZVjLykhH151rbJ1mnhfcIdhq0B3UIDEKjM9AqvA/UXQBZRmuUEtI4iF3+r3sJbq5 V38JGRLwutCOSzIbs2AMqrbCJk6yNK9jD60CJNk+NHM1d5gGP1YVZfLJ7aki2c46KFXU A9IQ== X-Gm-Message-State: AOJu0Yx8nIloazoFzY0ATa6J9Q1nRK6HV2bvKLoWAZDgkadYRD6WrX2r j9wZuX/kOMrVXhS+iPvC5hKtwJpOZ6TyH7A9ubDJkA89mQ6KkbmzqihYydYPsTJmtuYIH61ZiEN fIxhzzkegEcvFD1uvb15Ka9ob5ZFf0g== X-Gm-Gg: ATEYQzwRFWK2sWb7sQ76a1dkHUufLiolay/1YZNM3PxgaxIkzugaQnYNII6cKaOTa/n yPD99e4zDg/FB3p+Fv4rZsRdPYlJEpTT+l6rma/SvS7rAekCdH3iM5JRGjtMwVM+h6r4QkC5e6i dvHszN98lD+A6ph6f8HbB9fRPbcVTD0lzd5XlysbDnIg1s93SgUohnVm6lzywUAFmjg0oEMBrJ7 q6ALJfGp1VTsCVHqwDiupR3rFthGoMzCW4MSU6ElUpJXCHlnWB+Sl/dht+O8gsZ72JNz7C08REs nHqmU26OTYciKGVHZI8tl4rL1uslScwjggUP92NIfPw= X-Received: by 2002:a05:620a:269a:b0:8cf:bd14:92eb with SMTP id af79cd13be357-8d001072bbamr833596185a.68.1774503649381; Wed, 25 Mar 2026 22:40:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shinya Kato Date: Thu, 26 Mar 2026 14:40:37 +0900 X-Gm-Features: AQROBzBwm1E0FfptPnG7CgRo0hsp2IhlkhJkDkr7vGFwf2iWFIJmD2D4wk-uwbs Message-ID: Subject: Re: pg_stat_replication.*_lag sometimes shows NULL during active replication To: Fujii Masao Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000ac90d9064de6d31c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ac90d9064de6d31c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 26, 2026, 00:30 Fujii Masao wrote: > On Wed, Mar 25, 2026 at 4:03=E2=80=AFPM Shinya Kato > wrote: > > Thanks for the updated patch. LGTM. > > > > Regarding the backpatch, I'd personally appreciate it if the walsender.= c > changes were backpatched to stable branches. As you noted, it don't fully > solve the reported issue, but they do help reduce the cases where lag > columns in pg_stat_replication unexpectedly become NULL. > > > > Even a partial mitigation in the back branches would be valuable for > users running stable releases. > > +1 > > I've split the changes into two patches. > > Patch 0001 fixes premature NULL lag reporting in walsender. I will commit > it > and backpatch it to all supported branches. > > Patch 0002 avoids sending duplicate WAL locations in standby status > replies. > I will commit this to master only. > Thanks, LGTM. Best regards, Shinya Kato > --000000000000ac90d9064de6d31c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Mar 26, 2026, 00:30 Fuji= i Masao <masao.fujii@gmail.com<= /a>> wrote:
On Wed, Mar 25, 2026= at 4:03=E2=80=AFPM Shinya Kato <shinya11.kato@gmail.com> wr= ote:
> Thanks for the updated patch. LGTM.
>
> Regarding the backpatch, I'd personally appreciate it if the walse= nder.c changes were backpatched to stable branches. As you noted, it don= 9;t fully solve the reported issue, but they do help reduce the cases where= lag columns in pg_stat_replication unexpectedly become NULL.
>
> Even a partial mitigation in the back branches would be valuable for u= sers running stable releases.

+1

I've split the changes into two patches.

Patch 0001 fixes premature NULL lag reporting in walsender. I will commit i= t
and backpatch it to all supported branches.

Patch 0002 avoids sending duplicate WAL locations in standby status replies= .
I will commit this to master only.

Thanks, LGTM.

=
Best regards,
Shinya Kato
--000000000000ac90d9064de6d31c--