Re: GetBufferDescriptor() being called for local buffers from MarkBufferDirtyHint()
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Ayush Tiwari <ayushtiwari.slg01@gmail.com>, Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-07-03T03:07:21Z
Lists: 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
Commits
-
Switch Get[Local]BufferDescriptor() to use a signed value in input
- ba4134075a82 master landed
-
Fix MarkBufferDirtyHint() to not call GetBufferDescriptor() for local buffers
- e18b0cb7344c 19 (unreleased) landed
-
Require share-exclusive lock to set hint bits and to flush
- 82467f627bd4 19 (unreleased) cited