summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2021-03-02 13:02:24 -0800
committerPeter Geoghegan <pg@bowt.ie>2021-03-02 13:02:24 -0800
commit3d8d5787a358156edaa7782f0c88e231af974a01 (patch)
tree41a5b46ee083eb267201f922ff6b2de52dc8bc25
parentd16f8c8e416d288bd4734ed5f14076b62ec8d153 (diff)
Fix nbtree page deletion error messages.
Adjust some "can't happen" error messages that assumed that the page deletion target page must be a half-dead page. This assumption was wrong in the case of an internal target page. Simply refer to these pages as the target page instead. Internal pages are never marked half-dead. There is exactly one half-dead page for each subtree undergoing deletion. The half-dead page is also the target subtree's leaf-level page. This has been the case since commit efada2b8, which totally overhauled nbtree page deletion.
-rw-r--r--src/backend/access/nbtree/nbtpage.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index 629a23628ef..84ea7eac58e 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -2420,20 +2420,21 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, BlockNumber scanblkno,
* only one vacuum process running at a time.
*/
if (P_RIGHTMOST(opaque) || P_ISROOT(opaque) || P_ISDELETED(opaque))
- elog(ERROR, "half-dead page changed status unexpectedly in block %u of index \"%s\"",
+ elog(ERROR, "target page changed status unexpectedly in block %u of index \"%s\"",
target, RelationGetRelationName(rel));
if (opaque->btpo_prev != leftsib)
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
- errmsg_internal("left link changed unexpectedly in block %u of index \"%s\"",
- target, RelationGetRelationName(rel))));
+ errmsg_internal("target page left link unexpectedly changed from %u to %u in block %u of index \"%s\"",
+ leftsib, opaque->btpo_prev, target,
+ RelationGetRelationName(rel))));
if (target == leafblkno)
{
if (P_FIRSTDATAKEY(opaque) <= PageGetMaxOffsetNumber(page) ||
!P_ISLEAF(opaque) || !P_ISHALFDEAD(opaque))
- elog(ERROR, "half-dead page changed status unexpectedly in block %u of index \"%s\"",
+ elog(ERROR, "target leaf page changed status unexpectedly in block %u of index \"%s\"",
target, RelationGetRelationName(rel));
/* Leaf page is also target page: don't set leaftopparent */
@@ -2445,8 +2446,8 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, BlockNumber scanblkno,
if (P_FIRSTDATAKEY(opaque) != PageGetMaxOffsetNumber(page) ||
P_ISLEAF(opaque))
- elog(ERROR, "half-dead page changed status unexpectedly in block %u of index \"%s\"",
- target, RelationGetRelationName(rel));
+ elog(ERROR, "target internal page on level %u changed status unexpectedly in block %u of index \"%s\"",
+ targetlevel, target, RelationGetRelationName(rel));
/* Target is internal: set leaftopparent for next call here... */
itemid = PageGetItemId(page, P_FIRSTDATAKEY(opaque));