Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3b6b54f

Browse files
Fix nbtree page split rmgr desc routine.
Include newitemoff in rmgr desc output for nbtree page split records. In passing, correct an obsolete comment that claimed that newitemoff is only logged for _L variant nbtree page split WAL records. Both issues were oversights in commit 2c03216, which revamped the WAL format. Author: Peter Geoghegan Backpatch: 9.5-, where the WAL format was revamped.
1 parent 7f1f72c commit 3b6b54f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/backend/access/rmgrdesc/nbtdesc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ btree_desc(StringInfo buf, XLogReaderState *record)
3838
{
3939
xl_btree_split *xlrec = (xl_btree_split *) rec;
4040

41-
appendStringInfo(buf, "level %u, firstright %d",
42-
xlrec->level, xlrec->firstright);
41+
appendStringInfo(buf, "level %u, firstright %d, newitemoff %d",
42+
xlrec->level, xlrec->firstright, xlrec->newitemoff);
4343
break;
4444
}
4545
case XLOG_BTREE_VACUUM:

src/include/access/nbtxlog.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,12 @@ typedef struct xl_btree_insert
8282
*
8383
* Note: XLOG_BTREE_SPLIT_L and XLOG_BTREE_SPLIT_R share this data record.
8484
* There are two variants to indicate whether the inserted tuple went into the
85-
* left or right split page (and thus, whether newitemoff and the new item are
86-
* stored or not). We always log the left page high key because suffix
87-
* truncation can generate a new leaf high key using user-defined code. This
88-
* is also necessary on internal pages, since the first right item that the
89-
* left page's high key was based on will have been truncated to zero
90-
* attributes in the right page (the original is unavailable from the right
91-
* page).
85+
* left or right split page (and thus, whether the new item is stored or not).
86+
* We always log the left page high key because suffix truncation can generate
87+
* a new leaf high key using user-defined code. This is also necessary on
88+
* internal pages, since the first right item that the left page's high key
89+
* was based on will have been truncated to zero attributes in the right page
90+
* (the original is unavailable from the right page).
9291
*
9392
* Backup Blk 0: original page / new left page
9493
*
@@ -112,7 +111,7 @@ typedef struct xl_btree_split
112111
{
113112
uint32 level; /* tree level of page being split */
114113
OffsetNumber firstright; /* first item moved to right page */
115-
OffsetNumber newitemoff; /* new item's offset (if placed on left page) */
114+
OffsetNumber newitemoff; /* new item's offset (useful for _L variant) */
116115
} xl_btree_split;
117116

118117
#define SizeOfBtreeSplit (offsetof(xl_btree_split, newitemoff) + sizeof(OffsetNumber))

0 commit comments

Comments
 (0)