Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPIc6-0001R3-Oi for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Mar 2022 06:37:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nPIc5-0000N1-D1 for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Mar 2022 06:37:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPIc5-0000Ms-0F for pgsql-hackers@lists.postgresql.org; Wed, 02 Mar 2022 06:37:29 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nPIc2-0007aT-6x for pgsql-hackers@postgresql.org; Wed, 02 Mar 2022 06:37:28 +0000 Received: by mail-pl1-x62c.google.com with SMTP id s1so726769plg.12 for ; Tue, 01 Mar 2022 22:37:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=wsyJ/mbGwO0RZKWCCu3zncPMLZVEsnmVAhRb8xWWyA4=; b=JQtnjeqg0/skHd4F7N+HhvRJR+fanT3ZmDVILhVT2qf6fWOKb6i9A1uBr6PdfTgQYo /poeIjr1/U0j2PMxTWKpZA/ftMZ+ubn9hme4VY9sRdBWBAoBV7ctQGfEkffXWSGPeOG4 H6JRsfvcSb8LCFbJqGNBksb/sCaKHHIJiBSnzhjBRqoWoLeiQPA5nZjCj0ZkErD5iP/K a58Fl3nPbEQB4RcV5n7r9jX881fuzl+z9QMRj7j8zGkesIWNrTGuKcRW0y/996u9GC+l 1gdlAlTT6eYjeHH2mGsD8V5irMCXSc3VvUPnI/4MqvDaOl8HrFrrOHi6Yjh5PXKfH7BM levg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=wsyJ/mbGwO0RZKWCCu3zncPMLZVEsnmVAhRb8xWWyA4=; b=h/QjiBzgCJ88aLLYdMCoBUzvvYn0JSVskOL6jB3P2N+IpduQVCjpEX2Z7gZPESxCj/ ie0cDwEeVIfAAGpw/tSbC/J7u2zIKLG/4O2HeURUgHxD9zXzisCg3oKFmFdxomyE0wUJ lY8W2NoebizBsK4e/ifLFYj9a3Sw79u1Z/8yeOzPZvfdjRHOFvMUjLAdtV2zoXYxFlIw 4dR2pHHct6KYNpSKwwLZwQrMHXz5CKl91oUfWOv9Hescu3bGjqgTveeh/utcS/LbM3/V 6hTJuHLnN1Dbu6+4c4nZlsZV9HTM8vNhToJ6zmnSnOEN1PCqkrehtodyq4O1CABpcwfk +ZYA== X-Gm-Message-State: AOAM530tI+sF2PKunSBJNUkI6iveG2wn4Fwgwi6QJy6B/l6UXx67wuSp L0vTf05Oc8N0B92FtKf1jxQ= X-Google-Smtp-Source: ABdhPJw+BzLj1Bnj8pQLORpZVLZVyUtOHijfEqva7/E8n+BlI3hmdVIL5DJSPLf7h6bS2V3ecw9mBQ== X-Received: by 2002:a17:90a:ce08:b0:1bc:16cb:343d with SMTP id f8-20020a17090ace0800b001bc16cb343dmr25530163pju.158.1646203043690; Tue, 01 Mar 2022 22:37:23 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id y191-20020a638ac8000000b0036c7329efadsm14786450pgd.65.2022.03.01.22.37.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 01 Mar 2022 22:37:22 -0800 (PST) Date: Wed, 02 Mar 2022 15:37:19 +0900 (JST) Message-Id: <20220302.153719.171492355527427161.horikyota.ntt@gmail.com> To: sawada.mshk@gmail.com Cc: ashutosh.bapat.oss@gmail.com, pgsql-hackers@postgresql.org Subject: Re: more descriptive message for process termination due to max_slot_wal_keep_size From: Kyotaro Horiguchi In-Reply-To: <20220104.102931.1400105396066285349.horikyota.ntt@gmail.com> References: <20211224.173016.2237752923975758130.horikyota.ntt@gmail.com> <20220104.102931.1400105396066285349.horikyota.ntt@gmail.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Wed_Mar__2_15_37_19_2022_143)--" Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----Next_Part(Wed_Mar__2_15_37_19_2022_143)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit At Tue, 04 Jan 2022 10:29:31 +0900 (JST), Kyotaro Horiguchi wrote in > So what do you say if I propose the following? > > LOG: terminating process %d to release replication slot \"%s\" > because its restart_lsn %X/%X exceeds the limit %X/%X > HINT: You might need to increase max_slot_wal_keep_size. This version emits the following message. [35785:checkpointer] LOG: terminating process 36368 to release replication slot "s1" because its restart_lsn 0/1F000148 exceeds the limit 0/21000000 [35785:checkpointer] HINT: You might need to increase max_slot_wal_keep_size. [36368:walsender] FATAL: terminating connection due to administrator command [36368:walsender] STATEMENT: START_REPLICATION SLOT "s1" 0/1F000000 TIMELINE 1 [35785:checkpointer] LOG: invalidating slot "s1" because its restart_lsn 0/1F000148 exceeds the limit 0/21000000 [35785:checkpointer] HINT: You might need to increase max_slot_wal_keep_size. We can omit the HINT line from the termination log for non-persistent slots but I think we don't want to bother that considering its low frequency. The CI was confused by the mixed patches for multiple PG versions. In this version the patchset for master are attached as .patch and that for PG13 as .txt. regards. -- Kyotaro Horiguchi NTT Open Source Software Center ----Next_Part(Wed_Mar__2_15_37_19_2022_143)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="v4-0001-Make-a-message-on-process-termination-more-dscrip.patch" From 4909db2893f0b33ab6bca1ffc3ad802cd159c577 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi Date: Fri, 24 Dec 2021 12:52:07 +0900 Subject: [PATCH v4 1/2] Make a message on process termination more dscriptive The message at process termination due to slot limit doesn't provide the reason. In the major scenario the message is followed by another message about slot invalidatation, which shows the detail for the termination. However the second message is missing if the slot is temporary one. Augment the first message with the reason same as the second message. Backpatch through to 13 where the message was introduced. Reported-by: Alex Enachioaie Author: Kyotaro Horiguchi Reviewed-by: Ashutosh Bapat Reviewed-by: Bharath Rupireddy Discussion: https://www.postgresql.org/message-id/17327-89d0efa8b9ae6271%40postgresql.org Backpatch-through: 13 --- src/backend/replication/slot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index caa6b29756..92f19bcb35 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -1300,8 +1300,9 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlot *s, XLogRecPtr oldestLSN, if (last_signaled_pid != active_pid) { ereport(LOG, - (errmsg("terminating process %d to release replication slot \"%s\"", - active_pid, NameStr(slotname)))); + (errmsg("terminating process %d to release replication slot \"%s\" because its restart_lsn %X/%X exceeds max_slot_wal_keep_size", + active_pid, NameStr(slotname), + LSN_FORMAT_ARGS(restart_lsn)))); (void) kill(active_pid, SIGTERM); last_signaled_pid = active_pid; -- 2.27.0 ----Next_Part(Wed_Mar__2_15_37_19_2022_143)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="v4-0002-Add-detailed-information-to-slot-invalidation-mes.patch" From f31014f85c7dec160bd42e1c48f1c28a7dc22af2 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi Date: Fri, 24 Dec 2021 12:58:25 +0900 Subject: [PATCH v4 2/2] Add detailed information to slot-invalidation messages The messages says just "exceeds max_slot_wal_keep_size" but doesn't tell the concrete LSN of the limit. That information helps operators' understanding on the issue. Author: Kyotaro Horiguchi Reviewed-by: Ashutosh Bapat Reviewed-by: Masahiko Sawada Discussion: https://www.postgresql.org/message-id/17327-89d0efa8b9ae6271%40postgresql.org --- src/backend/replication/slot.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index 92f19bcb35..be21b62add 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -1300,9 +1300,11 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlot *s, XLogRecPtr oldestLSN, if (last_signaled_pid != active_pid) { ereport(LOG, - (errmsg("terminating process %d to release replication slot \"%s\" because its restart_lsn %X/%X exceeds max_slot_wal_keep_size", + (errmsg("terminating process %d to release replication slot \"%s\" because its restart_lsn %X/%X exceeds the limit %X/%X", active_pid, NameStr(slotname), - LSN_FORMAT_ARGS(restart_lsn)))); + LSN_FORMAT_ARGS(restart_lsn), + LSN_FORMAT_ARGS(oldestLSN)), + errhint("You might need to increase max_slot_wal_keep_size."))); (void) kill(active_pid, SIGTERM); last_signaled_pid = active_pid; @@ -1345,9 +1347,11 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlot *s, XLogRecPtr oldestLSN, ReplicationSlotRelease(); ereport(LOG, - (errmsg("invalidating slot \"%s\" because its restart_lsn %X/%X exceeds max_slot_wal_keep_size", + (errmsg("invalidating slot \"%s\" because its restart_lsn %X/%X exceeds the limit %X/%X", NameStr(slotname), - LSN_FORMAT_ARGS(restart_lsn)))); + LSN_FORMAT_ARGS(restart_lsn), + LSN_FORMAT_ARGS(oldestLSN)), + errhint("You might need to increase max_slot_wal_keep_size."))); /* done with this slot for now */ break; -- 2.27.0 ----Next_Part(Wed_Mar__2_15_37_19_2022_143)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="v4-0001-Make-a-message-on-process-termination-more-dscrip_13.txt" From 6c5a680842521b26c0c899c3d0675bd53e58ac11 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi Date: Fri, 24 Dec 2021 13:23:54 +0900 Subject: [PATCH v4] Make a message on process termination more dscriptive The message at process termination due to slot limit doesn't provide the reason. In the major scenario the message is followed by another message about slot invalidatation, which shows the detail for the termination. However the second message is missing if the slot is temporary one. Augment the first message with the reason same as the second message. Backpatch through to 13 where the message was introduced. Reported-by: Alex Enachioaie Author: Kyotaro Horiguchi Reviewed-by: Ashutosh Bapat Reviewed-by: Bharath Rupireddy Discussion: https://www.postgresql.org/message-id/17327-89d0efa8b9ae6271%40postgresql.org Backpatch-through: 13 --- src/backend/replication/slot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index 02047ea920..15b8934ae2 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -1228,8 +1228,10 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlot *s, XLogRecPtr oldestLSN, if (last_signaled_pid != active_pid) { ereport(LOG, - (errmsg("terminating process %d to release replication slot \"%s\"", - active_pid, NameStr(slotname)))); + (errmsg("terminating process %d to release replication slot \"%s\" because its restart_lsn %X/%X exceeds max_slot_wal_keep_size", + active_pid, NameStr(slotname), + (uint32) (restart_lsn >> 32), + (uint32) restart_lsn))); (void) kill(active_pid, SIGTERM); last_signaled_pid = active_pid; -- 2.27.0 ----Next_Part(Wed_Mar__2_15_37_19_2022_143)----