From: Alexander Lakhin <exclusion@gmail.com>
To: tender wang <tndrwang@gmail.com>
To: pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Subject: Re: BUG #18259: Assertion in ExtendBufferedRelLocal() fails after no-space-left condition
Date: Wed, 27 Dec 2023 10:00:00 +0300
Message-ID: <09677462-ed4c-2b2c-7918-8a3961dc772a@gmail.com> (raw)
In-Reply-To: <CAHewXNnayN3NM1HfaOCejk=sGfSva6ZDArWxKiTxL7PdDHRtMw@mail.gmail.com>
References: <18259-6e256429825dd435@postgresql.org>
<CAHewXNm4ktpPy=9g7NAYV=BoW-Ao3taZREPTcXnJDZ6P5esiag@mail.gmail.com>
<CAHewXNnayN3NM1HfaOCejk=sGfSva6ZDArWxKiTxL7PdDHRtMw@mail.gmail.com>
Hello tender wang,
26.12.2023 19:55, tender wang write:
> I tried to analyze the issue, and I found that it might be caused by this commit:
> commit dad50f677c42de207168a3f08982ba23c9fc6720
> bufmgr: Acquire and clean victim buffer separately
>
Thanks for looking into it!
> ...
>
> With debug logging added in this code within ExtendBufferedRelLocal():
> if (found)
> {
> BufferDesc *existing_hdr =
> GetLocalBufferDescriptor(hresult->id);
> uint32 buf_state;
>
> UnpinLocalBuffer(BufferDescriptorGetBuffer(victim_buf_hdr));
>
> existing_hdr = GetLocalBufferDescriptor(hresult->id);
> PinLocalBuffer(existing_hdr, false);
> buffers[i] = BufferDescriptorGetBuffer(existing_hdr);
>
> buf_state = pg_atomic_read_u32(&existing_hdr->state);
> Assert(buf_state & BM_TAG_VALID);
> Assert(!(buf_state & BM_DIRTY));
> buf_state &= BM_VALID;
> pg_atomic_unlocked_write_u32(&existing_hdr->state, buf_state);
> ...
> I see that it reached for the second INSERT (and NOSPC error) with
> existing_hdr->state == 0x2040000, but for the third INSERT I observe
> state == 0x0.
>
I wonder, if "buf_state &= BM_VALID" is a typo here, maybe it supposed to be
"buf_state &= ~BM_VALID" as in ExtendBufferedRelShared()...
Best regards,
Alexander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: exclusion@gmail.com, tndrwang@gmail.com, andres@anarazel.de
Subject: Re: BUG #18259: Assertion in ExtendBufferedRelLocal() fails after no-space-left condition
In-Reply-To: <09677462-ed4c-2b2c-7918-8a3961dc772a@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox