pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Pengfei Wang <pengfei.wang@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: issue: nbtpage.c,_bt_pagedel may get wrong result
Date: Thu, 23 May 2024 14:13:53 +0300
Message-ID: <6abbe3cf-9763-4b9c-b3c7-0d0fc6e2c685@iki.fi> (raw)
In-Reply-To: <CALsf3S3YU43Km==Faya5MPugPo=GE4-akae8oj6pgw_xEh_cEA@mail.gmail.com>
References: <CALsf3S3YU43Km==Faya5MPugPo=GE4-akae8oj6pgw_xEh_cEA@mail.gmail.com>

On 23/05/2024 13:06, Pengfei Wang wrote:
> # issue
> https://github.com/postgres/postgres/blob/da32f5c4bca7f3447b869de2afbbfa0b74443d45/src/backend/acces... <https://github.com/postgres/postgres/blob/da32f5c4bca7f3447b869de2afbbfa0b74443d45/src/backend/acces...;
> 
>     /*
>     * To avoid deadlocks, we'd better drop the leaf page lock
>     * before going further.
>     */
>     _bt_unlockbuf(rel, leafbuf);
> 
>     /*
>     * Check that the left sibling of leafbuf (if any) is not
>     * marked with INCOMPLETE_SPLIT flag before proceeding
>     */
>     Assert(leafblkno == scanblkno);
>     if (_bt_leftsib_splitflag(rel, leftsib, leafblkno))
>     {
>          ReleaseBuffer(leafbuf);
>          return;
>     }
> 
> After unlocking leaf, but before call _bt_leftsib_splitflag, leftsib may 
> be already split, and leafbuf's current left sibling is in 
> INCOMPLETE_SPLIT status.

In that case, there should be a downlink for 'leafbuf' in the parent, 
and we're good to proceed, right? See the comments in 
_bt_leftsib_splitflag().

-- 
Heikki Linnakangas
Neon (https://neon.tech)






view thread (3+ messages)  latest in thread

Message-ID: <6abbe3cf-9763-4b9c-b3c7-0d0fc6e2c685@iki.fi>
Permalink:  ../6abbe3cf-9763-4b9c-b3c7-0d0fc6e2c685@iki.fi/
Also on:    postgresql.org/message-id/6abbe3cf-9763-4b9c-b3c7-0d0fc6e2c685@iki.fi

 · 

reply

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: hlinnaka@iki.fi, pengfei.wang@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: issue: nbtpage.c,_bt_pagedel may get wrong result
  In-Reply-To: <6abbe3cf-9763-4b9c-b3c7-0d0fc6e2c685@iki.fi>

* 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