]> granicus.if.org Git - postgresql/commitdiff
Fix nbtree page split rmgr desc routine.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 12 Sep 2019 22:45:05 +0000 (15:45 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 12 Sep 2019 22:45:05 +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 80bd70a9751038c58e5f2f03067988b55c40f9a4..4d7d8e6aab1ea1cd40a969c0f7a8fd0837792174 100644 (file)
@@ -40,8 +40,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 819373031cdf262713377bda2fb1f55368138a76..d69c9e33bae8ef76f515d1643a7bcdc2a9fc940f 100644 (file)
@@ -82,12 +82,12 @@ typedef struct xl_btree_insert
  *
  * Note: the four XLOG_BTREE_SPLIT xl_info codes all use this data record.
  * The _L and _R variants 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).  The _HIGHKEY variants indicate that we've logged
- * explicitly left page high key value, otherwise redo should use right page
- * leftmost key as a left page high key.  _HIGHKEY is specified for internal
- * pages where right page leftmost key is suppressed, and for leaf pages
- * of covering indexes where high key have non-key attributes truncated.
+ * left or right split page (and thus, whether the new item is stored or not).
+ * The _HIGHKEY variants indicate that we've logged explicitly left page high
+ * key value, otherwise redo should use right page leftmost key as a left page
+ * high key.  _HIGHKEY is specified for internal pages where right page
+ * leftmost key is suppressed, and for leaf pages of covering indexes where
+ * high key have non-key attributes truncated.
  *
  * Backup Blk 0: original page / new left page
  *
@@ -109,7 +109,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))