Re: Annoying warning in SerializeClientConnectionInfo - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: Annoying warning in SerializeClientConnectionInfo
Date
Msg-id CAOYmi+=UjAHzm0MXBvRCYf0Fz0OzgXh0K4wXM5aBdkV7Ei1T_w@mail.gmail.com
Whole thread Raw
In response to Re: Annoying warning in SerializeClientConnectionInfo  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Annoying warning in SerializeClientConnectionInfo
List pgsql-hackers
On Mon, Aug 11, 2025 at 7:34 PM Michael Paquier <michael@paquier.xyz> wrote:
> And the rest was looking OK, so appending a
> PG_USED_FOR_ASSERTS_ONLY in the declaration seems OK from here.

If we're the first to use the attribute this way, I think I'd prefer
to put it on the definition only.

> I'd rather keep the sanity check on maxsize, even if it means to have
> a tweak based on the size of SerializedClientConnectionInfo.

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().

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.

> Another thing that we can do is use an USE_ASSERT_CHECKING around the
> variable getting set, but as far as I can see the
> PG_USED_FOR_ASSERTS_ONLY in the function declaration should work fine.
> If the buildfarm blurps on the first approach, we could always use the
> second approach as fallback.

Agreed.

Thanks,
--Jacob



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected
Next
From: Jacob Champion
Date:
Subject: Re: Annoying warning in SerializeClientConnectionInfo