diff options
| author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-04-23 10:15:06 +0300 |
|---|---|---|
| committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-04-23 10:19:54 +0300 |
| commit | 4fafc4ecd9e4d224d92c4a8549c5646860787a5d (patch) | |
| tree | ff1cb07f1140ed9ae19f6a66ab94d154b9bbf5ee /src/include/access/nbtree.h | |
| parent | d26b042ce577a4012b9798528f0b1bcfa6e502eb (diff) | |
| download | postgresql-4fafc4ecd9e4d224d92c4a8549c5646860787a5d.tar.gz | |
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.
Diffstat (limited to 'src/include/access/nbtree.h')
| -rw-r--r-- | src/include/access/nbtree.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 64c6982f50..1a8b16d45e 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -379,13 +379,15 @@ typedef struct xl_btree_vacuum typedef struct xl_btree_mark_page_halfdead { xl_btreetid target; /* deleted tuple id in parent page */ + + /* information needed to recreate the leaf page: */ BlockNumber leafblk; /* leaf block ultimately being deleted */ BlockNumber leftblk; /* leaf block's left sibling, if any */ BlockNumber rightblk; /* leaf block's right sibling */ - BlockNumber downlink; /* next child down in the branch */ + BlockNumber topparent; /* topmost internal page in the branch */ } xl_btree_mark_page_halfdead; -#define SizeOfBtreeMarkPageHalfDead (offsetof(xl_btree_mark_page_halfdead, downlink) + sizeof(BlockNumber)) +#define SizeOfBtreeMarkPageHalfDead (offsetof(xl_btree_mark_page_halfdead, topparent) + sizeof(BlockNumber)) /* * This is what we need to know about deletion of a btree page. Note we do @@ -406,7 +408,7 @@ typedef struct xl_btree_unlink_page BlockNumber leafblk; BlockNumber leafleftsib; BlockNumber leafrightsib; - BlockNumber downlink; /* next child down in the branch */ + BlockNumber topparent; /* next child down in the branch */ TransactionId btpo_xact; /* value of btpo.xact for use in recovery */ /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_UNLINK_PAGE_META */ |
