]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix nbtree page split rmgr desc routine.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 12 Sep 2019 22:44:59 +0000 (15:44 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 12 Sep 2019 22:44:59 +0000 (15:44 -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/nbtree.h

index a713d7f222b1b46ab3cad9760f609a682b9d16e1..66ed163b9784d109407230d1c352552cc33f1a1f 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 d8c14e0493ad4754c6873c428ae62e481f5ca0b1..f272eea37a9a11673f6dc7c135fade8abf2e7036 100644 (file)
@@ -265,11 +265,11 @@ 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 _ROOT variants indicate that we are splitting
- * the root page, and thus that a newroot record rather than an insert or
- * split record should follow.  Note that a split record never carries a
- * metapage update --- we'll do that in the parent-level update.
+ * left or right split page (and thus, whether the new item is stored or not).
+ * The _ROOT variants indicate that we are splitting the root page, and thus
+ * that a newroot record rather than an insert or split record should follow.
+ * Note that a split record never carries a metapage update --- we'll do that
+ * in the parent-level update.
  *
  * Backup Blk 0: original page / new left page
  *
@@ -291,7 +291,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 variants) */
 } xl_btree_split;
 
 #define SizeOfBtreeSplit       (offsetof(xl_btree_split, newitemoff) + sizeof(OffsetNumber))