When testing extensions using pgregress, it can be useful to introduce
some new DEBUG logs which are specific to the extension and change the
log level during part of the of the test.

There's a problem though: Often a "rehashing catalog cache ..." debug
message will also show up in those cases. It's not always possible to
predict when these messages show, and when they do their contents can
easily change if changes are made to an unrelated test or when run
against a different Postgres version. This change lowers the log level
of these messages to DEBUG5, so that they can be ignored while still
showing other (more predictable) DEBUG messages.
From 535e7afd0f5cc6939ff9981f47159e4f88f03b9f Mon Sep 17 00:00:00 2001
From: Jelte Fennema-Nio <github-t...@jeltef.nl>
Date: Fri, 30 May 2025 14:22:49 +0200
Subject: [PATCH v1] Reduce DEBUG level of catcache refreshing messages

When testing extensions using pgregress, it can be useful to introduce
some new DEBUG logs which are specific to the extension and change the
log level during part of the of the test.

There's a problem though: Often a "rehashing catalog cache ..." debug
message will also show up in those cases. It's not always possible to
predict when these messages show, and when they do their contents can
easily change if changes are made to an unrelated test or when run
against a different Postgres version. This change lowers the log level
of these messages to DEBUG5, so that they can be ignored while still
showing other (more predictable) DEBUG messages.
---
 src/backend/utils/cache/catcache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 657648996c2..fde6681bedc 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -988,7 +988,7 @@ RehashCatCache(CatCache *cp)
 	int			newnbuckets;
 	int			i;
 
-	elog(DEBUG1, "rehashing catalog cache id %d for %s; %d tups, %d buckets",
+	elog(DEBUG5, "rehashing catalog cache id %d for %s; %d tups, %d buckets",
 		 cp->id, cp->cc_relname, cp->cc_ntup, cp->cc_nbuckets);
 
 	/* Allocate a new, larger, hash table. */
@@ -1026,7 +1026,7 @@ RehashCatCacheLists(CatCache *cp)
 	int			newnbuckets;
 	int			i;
 
-	elog(DEBUG1, "rehashing catalog cache id %d for %s; %d lists, %d buckets",
+	elog(DEBUG5, "rehashing catalog cache id %d for %s; %d lists, %d buckets",
 		 cp->id, cp->cc_relname, cp->cc_nlist, cp->cc_nlbuckets);
 
 	/* Allocate a new, larger, hash table. */

base-commit: c3eda50b0648005281c2a3cf95375708f8ef97fc
-- 
2.43.0

Reply via email to