Re: Fwd: Why we need to check for local buffers in BufferIsExclusiveLocked and BufferIsDirty? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Fwd: Why we need to check for local buffers in BufferIsExclusiveLocked and BufferIsDirty?
Date
Msg-id 2033594.1738175525@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why we need to check for local buffers in BufferIsExclusiveLocked and BufferIsDirty?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Srinath Reddy <srinath2133@gmail.com> writes:
> as suggested did not change the BufferIsExclusiveLocked's signature and
> here's the patch for the same.

Yeah, that's better.  The whole point of changing these is to make
them do what extensions could reasonably expect, so a new API does
not seem like what's wanted.

If we cared about the speed of that assertion in XLogRegisterBuffer,
I think the thing to do would be to invent a single new function that
tests for both dirty and exclusive-locked.  Really BufferIsDirty
does that already, at least in assertion builds, so we could just do

-        Assert(BufferIsExclusiveLocked(buffer) && BufferIsDirty(buffer));
+        Assert(BufferIsDirty(buffer));

But I don't think we actually care that much about the speed of an
assertion, and it might be confusing since this doesn't quite
match the comment above it.  So I'm inclined to leave that alone.

I pushed your patch after fooling with the comments a bit.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Eagerly scan all-visible pages to amortize aggressive vacuum
Next
From: Ilia Evdokimov
Date:
Subject: Re: Sample rate added to pg_stat_statements