Re: Assert in heapgettup_pagemode() fails due to underlying buffer change

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Thomas Munro <thomas.munro@gmail.com>, Alexander Lakhin <exclusion@gmail.com>, Noah Misch <noah@leadboat.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-06-07T12:46:51Z
Lists: pgsql-hackers
On Fri, Jun 7, 2024 at 4:05 AM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> >  static void
> > -ZeroBuffer(Buffer buffer, ReadBufferMode mode)
> > +ZeroBuffer(Buffer buffer, ReadBufferMode mode, bool zero)
>
> This change makes the API very strange.  Should the function be called
> ZeroAndLockBuffer() instead?  Then the addition of a "bool zero"
> argument makes a lot more sense.

I agree that's better, but it still looks a bit weird. You have to
realize that 'bool zero' means 'is already zeroed' here -- or at
least, I guess that's the intention. But then I wonder why you'd call
a function called ZeroAndLockBuffer if all you need to do is
LockBuffer.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Commits

  1. Fix RBM_ZERO_AND_LOCK.

  2. Provide vectored variant of ReadBuffer().