Re: GetBufferDescriptor() being called for local buffers from MarkBufferDirtyHint()

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-07-02T04:46:54Z
Lists: pgsql-hackers
On Wed, Jul 01, 2026 at 08:00:38PM +0530, Ayush Tiwari wrote:
> v2 attached sets NLocBuffer = nbufs before the initialization loop, so the
> loop can keep using GetLocalBufferDescriptor(), and drops the now-redundant
> assignment at the end.

Catching up with the latest activity of this thread now that v20 has
opened up.  That's kind of nice.

I have been also reminded about BufferIsValid(), where we already have
similar assertions.  As a whole, that seems acceptable to me, and
using unsigned still does not make much sense here.

Any thoughts or objections regarding a HEAD-only change?
--
Michael

Commits

  1. Switch Get[Local]BufferDescriptor() to use a signed value in input

  2. Fix MarkBufferDirtyHint() to not call GetBufferDescriptor() for local buffers

  3. Require share-exclusive lock to set hint bits and to flush