On Tue, Aug 12, 2025 at 01:44:32PM -0700, Jacob Champion wrote:
> I don't think I understand what you mean by this? I don't want to get
> rid of the check, but I was wondering if we could strengthen the
> behavior on HEAD to raise an ERROR regardless of whether assertions
> are enabled or not. Similar to the approach taken by
> SerializeComboCIDState().

Yeah, we could do that as well.  I was looking at all routine calls,
but did not notice the elog(ERROR) thrown in this case for the
combocid case.

> I think the PG_USED_FOR_ASSERTS_ONLY fix is preferable for backport,
> so I don't want to get in the way of that approach.

The attached has been working for me.  Thoughts?
--
Michael
From 35cabb3ead7cb4b128ae093c0f39f2a65a94c2e2 Mon Sep 17 00:00:00 2001
From: Michael Paquier <mich...@paquier.xyz>
Date: Tue, 12 Aug 2025 11:10:07 +0900
Subject: [PATCH] Append PG_USED_FOR_ASSERTS_ONLY on a function variable

---
 src/include/miscadmin.h           | 3 ++-
 src/backend/utils/init/miscinit.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 1bef98471c36..4d8e827a269a 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -533,7 +533,8 @@ typedef void (*shmem_request_hook_type) (void);
 extern PGDLLIMPORT shmem_request_hook_type shmem_request_hook;
 
 extern Size EstimateClientConnectionInfoSpace(void);
-extern void SerializeClientConnectionInfo(Size maxsize, char *start_address);
+extern void SerializeClientConnectionInfo(Size maxsize PG_USED_FOR_ASSERTS_ONLY,
+										  char *start_address);
 extern void RestoreClientConnectionInfo(char *conninfo);
 
 /* in executor/nodeHash.c */
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 65d8cbfaed58..545d1e90fbd4 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -1099,7 +1099,8 @@ EstimateClientConnectionInfoSpace(void)
  * Serialize MyClientConnectionInfo for use by parallel workers.
  */
 void
-SerializeClientConnectionInfo(Size maxsize, char *start_address)
+SerializeClientConnectionInfo(Size maxsize PG_USED_FOR_ASSERTS_ONLY,
+							  char *start_address)
 {
 	SerializedClientConnectionInfo serialized = {0};
 
-- 
2.50.0

Attachment: signature.asc
Description: PGP signature

Reply via email to