pgsql: Refactor nbtree deletion INCOMPLETE_SPLIT check. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: Refactor nbtree deletion INCOMPLETE_SPLIT check.
Date
Msg-id E1jWpdj-0002OH-B3@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Refactor nbtree deletion INCOMPLETE_SPLIT check.

Factor out code common to _bt_lock_branch_parent() and _bt_pagedel()
into a new utility function.  This new function is used to check that
the left sibling of a deletion target page does not have the
INCOMPLETE_SPLIT page flag set.  If it is set then deletion is unsafe;
there won't be a usable pivot tuple (with a downlink) in the parent page
that points to the deletion target page.  The page deletion algorithm is
not prepared to deal with that.  Also restructure an existing, related
utility function that checks if the right sibling of the target page has
the ISHALFDEAD page flag set.

This organization highlights the symmetry between the two cases.  The
goal is to make the design of page deletion clearer.  Both functions
involve a sibling page with a flag that indicates that there was an
interrupted operation (a page split or a page deletion) that resulted in
a page pointed to by sibling pages, but not pointed to in the parent.
And, both functions indicate if page deletion is unsafe due to the
absence of a particular downlink in the parent page.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cd8c73a38a23c364e71973d6832a585616d24756

Modified Files
--------------
src/backend/access/nbtree/nbtpage.c | 184 ++++++++++++++++++++----------------
1 file changed, 100 insertions(+), 84 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix YA text phrase search bug.
Next
From: Fujii Masao
Date:
Subject: pgsql: Report missing wait event for timeline history file.