]> granicus.if.org Git - postgresql/commitdiff
Fix nbtree page split rmgr desc routine.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 12 Sep 2019 22:45:08 +0000 (15:45 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 12 Sep 2019 22:45:08 +0000 (15:45 -0700)
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 2c03216d831, which revamped the
WAL format.

Author: Peter Geoghegan
Backpatch: 9.5-, where the WAL format was revamped.

src/backend/access/rmgrdesc/nbtdesc.c
src/include/access/nbtxlog.h

index a14eb792ecd17d0b2994bf08238d34464af1bfbd..4ee6d04a68e55e9d8c2da9d643a695ef1857fc41 100644 (file)
@@ -38,8 +38,8 @@ btree_desc(StringInfo buf, XLogReaderState *record)
                        {
                                xl_btree_split *xlrec = (xl_btree_split *) rec;
 
-                               appendStringInfo(buf, "level %u, firstright %d",
-                                                                xlrec->level, xlrec->firstright);
+                               appendStringInfo(buf, "level %u, firstright %d, newitemoff %d",
+                                                                xlrec->level, xlrec->firstright, xlrec->newitemoff);
                                break;
                        }
                case XLOG_BTREE_VACUUM:
index afa614da2524919299ba570393c44b84a2c8dc48..91b9ee00cfc694a16a9af97d96defa624088e883 100644 (file)
@@ -82,13 +82,12 @@ typedef struct xl_btree_insert
  *
  * Note: XLOG_BTREE_SPLIT_L and XLOG_BTREE_SPLIT_R share this data record.
  * There are two variants to indicate whether the inserted tuple went into the
- * left or right split page (and thus, whether newitemoff and the new item are
- * stored or not).  We always log the left page high key because suffix
- * truncation can generate a new leaf high key using user-defined code.  This
- * is also necessary on internal pages, since the first right item that the
- * left page's high key was based on will have been truncated to zero
- * attributes in the right page (the original is unavailable from the right
- * page).
+ * left or right split page (and thus, whether the new item is stored or not).
+ * We always log the left page high key because suffix truncation can generate
+ * a new leaf high key using user-defined code.  This is also necessary on
+ * internal pages, since the first right item that the left page's high key
+ * was based on will have been truncated to zero attributes in the right page
+ * (the original is unavailable from the right page).
  *
  * Backup Blk 0: original page / new left page
  *
@@ -112,7 +111,7 @@ typedef struct xl_btree_split
 {
        uint32          level;                  /* tree level of page being split */
        OffsetNumber firstright;        /* first item moved to right page */
-       OffsetNumber newitemoff;        /* new item's offset (if placed on left page) */
+       OffsetNumber newitemoff;        /* new item's offset (useful for _L variant) */
 } xl_btree_split;
 
 #define SizeOfBtreeSplit       (offsetof(xl_btree_split, newitemoff) + sizeof(OffsetNumber))