Re: BUG #18259: Assertion in ExtendBufferedRelLocal() fails after no-space-left condition

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: tender wang <tndrwang@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>, pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Date: 2023-12-28T06:36:46Z
Lists: pgsql-bugs
On Wed, Dec 27, 2023 at 5:08 PM tender wang <tndrwang@gmail.com> wrote:

> Alexander Lakhin <exclusion@gmail.com> 于2023年12月27日周三 15:00写道:
>
>> I wonder, if "buf_state &= BM_VALID" is a typo here, maybe it supposed to
>> be
>> "buf_state &= ~BM_VALID" as in ExtendBufferedRelShared()...
>>
>
> Yeah, that's true.  I analyze this issue again, and I think the root cause
> is the " buf_state &= BM_VALID" .
>

Nice catch.  I believe the intention is to clear the BM_VALID bit.

By the way, I wonder if it would be worthwhile to define new macros for
bit operations such as set_bit, clear_bit, test_bit, and so on, so that
we can avoid such typos in the future.

Thanks
Richard

Commits

  1. Fix corruption of local buffer state during extend of temp relation

  2. bufmgr: Acquire and clean victim buffer separately