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 1w1vnK-000jGD-03 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 00:26:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w1vnJ-006TaC-0K for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 00:26:53 +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 1w1vnI-006TZy-2T for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 00:26:53 +0000 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w1vnB-00000000L7X-3sFW for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 00:26:48 +0000 Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-89a00e8dc04so39911126d6.0 for ; Sun, 15 Mar 2026 17:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773620804; cv=none; d=google.com; s=arc-20240605; b=ZHbQkFtg6jW5ynUMFKVLOikFbj4OcACmw/lA/XnvnKN0q1OB2ClhBLnOXpW3R9br+I Dzo2Y4XFqeOU3OyzJ8w+4flXe7peUqOov5B6sfOb11dE9YNpitnv1vlAxKaRJaxx8KHM sHM+XuiAoIaTAapTDk6R8vdlGBEHMd7SUpVsocrTs+WPetat7QWV4f5EVv8jXfLd8gI0 QRa2KLgbFLgB0ut4NkZdspANU3IPy8IyOT5CxUf5mctOrjA24lF6AEqYJ5d8grdPmJic 5q8TalnTH8ExLb0YwtTNjGQbi9BrROISGOdHf7H0U6IvvdPMVEIZ+igWYSjzIEy36OOX knQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LF5Bb+srOZep+o9xMnrswjsL+4bnjfj03jJJz/KmRKA=; fh=x4xgi4tdDukVB0fBuAIe3vORvD36rbbTBlhrrGN8QbM=; b=KaqPSVejQSqcC4dLOGg3UGLtHpIURzSoOS0xuzH600vVFjFIftG+qALwDJrH8Mn15z 0Td4++Wpld75iFb2LyDU+OriBpV+s3Q79P4oCKGsCcQ5iLrFix1nYQLiRqiPh/YDBUN/ B98qh82bF1qyAQVG36cTljevsN6g1aK6nSlYdZXnXoEz5X2S6GZO7QFySSqp3riCqOeH cNp6qZqKv/6e4TasVTo5W0qqcDp/YfZxPV7qRwpE86vdnBStZeH8nkzxxuf1HmUxDZX/ PR1SpWDwIXxUQT9YS+c62OZmX7g4N9n8ShN8ki0BsKcnYSdEvAVFiRL26cS7+YSTwu8S 5yZw==; 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=20230601; t=1773620804; x=1774225604; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LF5Bb+srOZep+o9xMnrswjsL+4bnjfj03jJJz/KmRKA=; b=mzk577X2OX/F3Wfbq2i8YRHOawNQPqN6yrzHP8prnFJihtQ1ujcQCfX4Gj3J8BxPvf bZV83Cm8BPaW0aLAT35eGXX4TbfTa/Tb9LRyM7l2QZDDye8OCVIoSUbycK+CuhZKK10X IY8WOlq/+9AkmEBjP6TBV5Xihc+fJVHzExVHX1YTXBJdCF1gRSn5GG4tXoecMZ2YRGhF 5eS0uR6H20WGjRLwvJSZ0Y8oK9nfCaA2j5c/o5pfTbx79q0gjKGnOtp9+veKjYHZ4383 1x69atJoPkpnZ/Jk4a07RyELJM2LS/h1+I0kN5471uNKkFgLCZvCVxdJb5TGjkEVcSr9 b1bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773620804; x=1774225604; h=content-transfer-encoding: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=LF5Bb+srOZep+o9xMnrswjsL+4bnjfj03jJJz/KmRKA=; b=q2Q0AtV89GNG1tcPQaXc4Um0Qox9nMenQGa/LPilRNtPwbzHXvFI0Qy8y3keXGFrZU MA02Ifnm3L0KZ2BZsEtjFOv0+n/Q06urBjz2CheIrUA4FQpMh3f/4BGDbNAc52p7VPIg l/hqih4NeNYtwma6ZTghH05inQtw2dGXCNLdaN6CzRLOLEULkxRUps4avT9d3lmn2rEQ cPQzliq8wmmed47JElcr2kb6fxVi2H3Bj3JJO7D11bB1dRsSS+VpQUNGs64D1nwGQ3Az x2OAIktALXSlKrF60p5eHAEQoes52uwVUBb/Guxwgrw4jVYBBNs14tO/NU1HS9QYatRB Ih4g== X-Gm-Message-State: AOJu0Yxk8Qnc3PBdzj7Va6oPjq5pmuXEPha5T16tG+h8jiK0qNgZiJhV Y3HQr3fNjbjBsbUncLQaoGh0VNIdENAjOQ8bkNAiw9CGw4Av9Px1LBW2Q2uZYdJMgUn6377Udnv /pbszSscK/s+KOeG0DbM89lzp/D1e+w== X-Gm-Gg: ATEYQzyVdXQMqgWVi9Fzc++u8+VRmB0J4MM8M2uhzbm+Fkpbk63ZbJYzvTmDId3ETU4 XeMNAio6GiRoc4bwJ54xRPbUgBP+3Y0htYTB1dPNE9JYzv66nTvtrPB5LpnoJVo3L58Njvkbise 7RjIMlnMXBKsbXBsGMS1p2b032Zns6OIYhG4xxGtfuQdGszSRjpEzeL/yAtEiH01M6lgykgAgfj ffMiXfPYYsV3CvG5NcQXJgEj2/2LTmR9fzQEFVnPyHQfloeCVbIdEkays8K43rJcc4XAA4rxIus v17z3zcct/6Xl9Inp3gDSqaJO8TIIBuOueMFMw== X-Received: by 2002:a05:6214:f0b:b0:899:ecd8:d266 with SMTP id 6a1803df08f44-89a81dc64afmr159744526d6.20.1773620803701; Sun, 15 Mar 2026 17:26:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shinya Kato Date: Mon, 16 Mar 2026 09:25:52 +0900 X-Gm-Features: AaiRm50G4r3yaazRa2uSgCVzNR2mbITEe-NDscDlXP265jMb9v9gBKZhIdU27Fc Message-ID: Subject: Re: pg_stat_replication.*_lag sometimes shows NULL during active replication To: Fujii Masao Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Mar 13, 2026 at 12:27=E2=80=AFAM Fujii Masao wrote: > Thanks for testing and for the clarification! You're right. > > However, if we apply this change, the time required for the lag informati= on to > be reset would effectively double. I start wondering if that's really > acceptable, especially for back branches. Although the docs doesn't clear= ly > specify this timing, doubling it could affect systems that monitor > replication lag, for example. It might still be reasonable to apply > such a change in master, though. Yes, I agree. Doubling the lag reset time should be avoided in back branches if possible. > On further thought, the root cause seems to be that walreceiver can send > two consecutive status reply messages with identical WAL locations even > when wal_receiver_status_interval has not yet elapsed. Addressing that > behavior directly might resolve the issue you reported. I've attached a P= oC > patch that does this. Thought? Thank you for the v4 patch. I think this approach is better than mine. I tested the patch and confirmed that the issue no longer reproduces with physical replication. However, with logical replication, the lag columns in pg_stat_replication still show NULL periodically at wal_receiver_status_interval, since send_feedback() in worker.c can still send duplicate positions. + * previsou update, i.e., when 'replyApply' is true. One minor thing: there is a typo "previsou". It should be "previous". --=20 Best regards, Shinya Kato NTT OSS Center