diff options
author | Peter Geoghegan <pg@bowt.ie> | 2020-05-11 11:01:07 -0700 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2020-05-11 11:01:07 -0700 |
commit | 624686abcf87d26fe7c03543c4a54aad2237cb93 (patch) | |
tree | 14ad51e2395697333d9d84f8ce9a12453aa5f6de /src/backend/access/nbtree/nbtxlog.c | |
parent | a8be5364ac1678e35029f547632d4002552f943c (diff) |
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.
Diffstat (limited to 'src/backend/access/nbtree/nbtxlog.c')
-rw-r--r-- | src/backend/access/nbtree/nbtxlog.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c index 493931e1b83..87a8612c28c 100644 --- a/src/backend/access/nbtree/nbtxlog.c +++ b/src/backend/access/nbtree/nbtxlog.c @@ -704,7 +704,7 @@ btree_xlog_mark_page_halfdead(uint8 info, XLogReaderState *record) * target page or not (since it's surely empty). */ - /* parent page */ + /* to-be-deleted subtree's parent page */ if (XLogReadBufferForRedo(record, 1, &buffer) == BLK_NEEDS_REDO) { OffsetNumber poffset; @@ -749,8 +749,8 @@ btree_xlog_mark_page_halfdead(uint8 info, XLogReaderState *record) pageop->btpo_cycleid = 0; /* - * Construct a dummy hikey item that points to the next parent to be - * deleted (if any). + * Construct a dummy high key item that points to top parent page (value + * is InvalidBlockNumber when the top parent page is the leaf page itself) */ MemSet(&trunctuple, 0, sizeof(IndexTupleData)); trunctuple.t_info = sizeof(IndexTupleData); @@ -837,7 +837,7 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record) /* * If we deleted a parent of the targeted leaf page, instead of the leaf * itself, update the leaf to point to the next remaining child in the - * branch. + * to-be-deleted subtree */ if (XLogRecHasBlockRef(record, 3)) { |