Re: GetBufferDescriptor() being called for local buffers from MarkBufferDirtyHint() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: GetBufferDescriptor() being called for local buffers from MarkBufferDirtyHint()
Date
Msg-id akcnadjOV4pv7ESL@paquier.xyz
Whole thread
List pgsql-hackers
On Fri, Jul 03, 2026 at 08:17:22AM +0530, Ashutosh Bapat wrote:
> An actual subtle problem does exist in check_temp_buffers.  If we set
> NLocBuffer to a non-zero value when LocalBufHash is not initialized,
> it's going to prohibit a change in the GUC. If LocalBufHash allocation
> fails, probably user would like to try again by reducing NLocBuffer.
> The prohibition makes that impossible.
>
> The other such usage in hashbuild() is fine, since it will allocate
> more space if at all.
>
> CheckForLocalBufferLeaks() walks the local buffer descriptor array,
> but it's already initialized when NLocBuffer is set.

Sure, now a lot of this code is also shaped with some internal static
routines, so I'm also slightly afraid of some refactorings.  It just
feels like in the long-term setting NLocBuffer earlier makes some of
the assumptions of the code a bit more brittle.  Not a bid deal,
still..
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: WAL compression setting after PostgreSQL LZ4 default change
Next
From: Michael Paquier
Date:
Subject: Re: GetBufferDescriptor() being called for local buffers from MarkBufferDirtyHint()