Adjust "root of to-be-deleted subtree" function.
authorPeter Geoghegan <pg@bowt.ie>
Mon, 11 May 2020 18:01:07 +0000 (11:01 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Mon, 11 May 2020 18:01:07 +0000 (11:01 -0700)
commit624686abcf87d26fe7c03543c4a54aad2237cb93
tree14ad51e2395697333d9d84f8ce9a12453aa5f6de
parenta8be5364ac1678e35029f547632d4002552f943c
Adjust "root of to-be-deleted subtree" function.

Restructure the function that locates the root of the to-be-deleted
subtree during nbtree page deletion.  Handle the conditions that make
page deletion unsafe in a slightly more uniform way, and acknowledge the
fact that the behavior with incomplete splits on internal pages is
different (as pointed out in the nbtree README as of commit 35bc0ec7).
Also invent new terminology that avoids ambiguity around which pages are
about to be deleted.  Consistently use the term "to-be-deleted subtree",
not the ambiguous term "branch".

We were calling the subtree parent page the "top parent page", but that
was quite misleading.  The top parent page usually refers to a page
unlinked from its siblings and marked deleted (during the second stage
of page deletion).  There was one kind of top parent page that we merely
removed a downlink from, and another kind of top parent page that we
actually marked deleted.  Eliminate the ambiguity by inventing a new
term ("subtree parent page") that refers to the former kind of page
only.
src/backend/access/nbtree/README
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtxlog.c
src/include/access/nbtxlog.h