Re: Buffer locking is special (hints, checksums, AIO writes) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Buffer locking is special (hints, checksums, AIO writes)
Date
Msg-id lkymqy2erm24hrdapeiwf3gzehrbr3wstfekolpvh2nneopazf@xlm4vab26dw5
Whole thread Raw
In response to Re: Buffer locking is special (hints, checksums, AIO writes)  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: Buffer locking is special (hints, checksums, AIO writes)
Re: Buffer locking is special (hints, checksums, AIO writes)
List pgsql-hackers
Hi,

On 2026-01-29 12:50:38 -0500, Peter Geoghegan wrote:
> On Thu, Jan 29, 2026 at 12:42 PM Andres Freund <andres@anarazel.de> wrote:
> > > -     /*
> > > -      * We better not already hold a lock on the buffer.
> > > -      */
> > >       Assert(entry->data.lockmode == BUFFER_LOCK_UNLOCK);
> > >
> >
> > Err, this should have been removed, I accidentally re-added the hunk while
> > experimenting.
> 
> I've been running into this assertion failure from time to time while
> working on index prefetching. It seems to happen after a hard crash.
> I've just been running initdb whenever it happens. It would be nice to
> not have to do this again.

Sure, I'm planning to give folks a bit longer to chime in whether the proposed
behavior is sane and will then push (with an amended commit message and the
fixup discussed here).


After a crash it seems that btree often ends up getting the page from FSM that
it's currently inserting on. Which makes some sense, because presumably that
was the page we filled just before a crash. Wonder if - independent of this
issue - it could make sense to update the FSM during nbtree WAL recovery...

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Pasword expiration warning
Next
From: Peter Geoghegan
Date:
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)