Hi,

On Thu, Aug 07, 2025 at 04:17:29PM +0900, Michael Paquier wrote:
> On Thu, Aug 07, 2025 at 05:28:17AM +0000, Bertrand Drouvot wrote:
> > On Thu, Aug 07, 2025 at 08:18:26AM +0900, Michael Paquier wrote:
> >> On Mon, Aug 04, 2025 at 01:00:35PM +0300, Kouber Saparev wrote:
> >> You are close to wraparound for this relation.  Is that vanilla
> >> streaming replication with heap?
> > 
> > I was wondering about adding the "generation" (introduced in 818119afccd3) 
> > to
> > the above error log message, thoughts?
> 
> Yes, that could prove to be useful when debugging such issues.  We do
> not have a lot of information here.

Yes, done in the attached.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
>From db0fb464258992b2596d528b14c5b73909e5d93e Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot...@gmail.com>
Date: Thu, 7 Aug 2025 07:58:40 +0000
Subject: [PATCH v1] Add more debugging information when dropping twice pgstats
 entry

Dropping twice a pgstats entry should not happen, still the error generated
is missing the "generation" counter that has been added in 818119afccd3.

This commit adds it as it could be helpful for debugging.
---
 src/backend/utils/activity/pgstat_shmem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
 100.0% src/backend/utils/activity/

diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index 53e7d534270..cca4277f234 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -874,11 +874,12 @@ pgstat_drop_entry_internal(PgStatShared_HashEntry *shent,
 	 */
 	if (shent->dropped)
 		elog(ERROR,
-			 "trying to drop stats entry already dropped: kind=%s dboid=%u objid=%" PRIu64 " refcount=%u",
+			 "trying to drop stats entry already dropped: kind=%s dboid=%u objid=%" PRIu64 " refcount=%u generation=%u",
 			 pgstat_get_kind_info(shent->key.kind)->name,
 			 shent->key.dboid,
 			 shent->key.objid,
-			 pg_atomic_read_u32(&shent->refcount));
+			 pg_atomic_read_u32(&shent->refcount),
+			 pg_atomic_read_u32(&shent->generation));
 	shent->dropped = true;
 
 	/* release refcount marking entry as not dropped */
-- 
2.34.1

Reply via email to