1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Cleanup of new b-tree page deletion code.

When marking a branch as half-dead, a pointer to the top of the branch is
stored in the leaf block's hi-key. During normal operation, the high key
was left in place, and the block number was just stored in the ctid field
of the high key tuple, but in WAL replay, the high key was recreated as a
truncated tuple with zero columns. For the sake of easier debugging, also
truncate the tuple in normal operation, so that the page is identical
after WAL replay. Also, rename the 'downlink' field in the WAL record to
'topparent', as that seems like a more descriptive name. And make sure
it's set to invalid when unlinking the leaf page.
This commit is contained in:
Heikki Linnakangas
2014-04-23 10:15:06 +03:00
parent d26b042ce5
commit 4fafc4ecd9
4 changed files with 33 additions and 18 deletions

View File

@@ -130,8 +130,8 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
appendStringInfoString(buf, "mark_page_halfdead: ");
out_target(buf, &(xlrec->target));
appendStringInfo(buf, "; downlink %u; leaf %u; left %u; right %u",
xlrec->downlink, xlrec->leafblk, xlrec->leftblk, xlrec->rightblk);
appendStringInfo(buf, "; topparent %u; leaf %u; left %u; right %u",
xlrec->topparent, xlrec->leafblk, xlrec->leftblk, xlrec->rightblk);
break;
}
case XLOG_BTREE_UNLINK_PAGE_META:
@@ -143,8 +143,8 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode);
appendStringInfo(buf, "dead %u; left %u; right %u; btpo_xact %u; ",
xlrec->deadblk, xlrec->leftsib, xlrec->rightsib, xlrec->btpo_xact);
appendStringInfo(buf, "leaf %u; leafleft %u; leafright %u; downlink %u",
xlrec->leafblk, xlrec->leafleftsib, xlrec->leafrightsib, xlrec->downlink);
appendStringInfo(buf, "leaf %u; leafleft %u; leafright %u; topparent %u",
xlrec->leafblk, xlrec->leafleftsib, xlrec->leafrightsib, xlrec->topparent);
break;
}
case XLOG_BTREE_NEWROOT: