From: | Pengfei Wang <pengfei(dot)wang(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | issue: nbtpage.c,_bt_pagedel may get wrong result |
Date: | 2024-05-23 10:06:24 |
Message-ID: | CALsf3S3YU43Km==Faya5MPugPo=GE4-akae8oj6pgw_xEh_cEA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> /*
> * 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.
# how to fix
In function _bt_leftsib_splitflag, after lock leftsib, we should lock
leafbuf again, then recheck if leafbuf's leftsib is still leftsib, if check
passed, keep lock on leafbuf.
--
Regards
Wang Pengfei
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2024-05-23 11:13:53 | Re: issue: nbtpage.c,_bt_pagedel may get wrong result |
Previous Message | Waka Ranai | 2024-05-23 09:39:24 | Re: Bug report - pg_upgrade tool seems to have a race condition when trying to delete a pg_wal file |