Re: BM_IO_ERROR flag is lost in TerminateBufferIO due to order of operations in UnlockBufHdrExt

From: Andres Freund <andres(at)anarazel(dot)de>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: BM_IO_ERROR flag is lost in TerminateBufferIO due to order of operations in UnlockBufHdrExt
Date: 2026-06-15 16:18:43
Message-ID: kbxmel4wair2vljofva327ralg6oyjjay2nhojdyup4zwvsmni@fxkknoi7ytp6
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-06-02 23:21:49 -0400, Andres Freund wrote:
> On 2026-06-02 12:15:40 -0400, Melanie Plageman wrote:
> > On Mon, Apr 6, 2026 at 4:21 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> > >
> > > On Mon, Mar 30, 2026 at 11:25:55AM +0300, Yura Sokolov wrote:
> > > > Have you any recommendations for patch?
> > > >
> > > > Should I create CF item for patch?
> > >
> > > The business with unset_flag_bits is new as of HEAD, so this could
> > > qualify as an open item, to be tracked here:
> > > https://wiki.postgresql.org/wiki/PostgreSQL_19_Open_Items
> >
> > There hasn't been recent activity on this thread and it is one of the
> > oldest open items. Even if we don't have time to review the test right
> > now, it is probably worth pushing the fix. Though we have just missed
> > beta1...
>
> Ugh. I had lost track of this. I'll get back to it as soon as I have squared
> the CI stuff away.

I'd hoped to push a patch by now, but unfortunately didn't yet, and I'm about
to take 4 days off outside of reception. So pushing it now seems unwise.

FWIW, I am inclined to just fix UnlockBufHdrExt() to first subtract and then
add the bits, rather than the other way round and document that fact. I think
that's cleaner than having to force callers to do their own bit math to
prevent bits from overlapping.

I played around a bunch with the tests, but I suspect it's better to wait with
testing this path until the write path is converted to AIO, otherwise we have
to introduce infrastructure that we'll just rip out again...

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-06-15 16:26:53 Re: Modernizing pg_bsd_indent's error/warning reporting code
Previous Message Alexander Kuzmenkov 2026-06-15 15:39:01 assertion failure with unique index + partitioning + join