Improve description of some WAL records for GIN
authorMichael Paquier <[email protected]>
Wed, 8 Oct 2025 04:57:04 +0000 (13:57 +0900)
committerMichael Paquier <[email protected]>
Wed, 8 Oct 2025 05:02:26 +0000 (14:02 +0900)
The following information is added in the description of some GIN
records:
- In INSERT_LISTPAGE, the number of tuples and the right link block.
- In UPDATE_META_PAGE, the number of tuples, the previous tail block,
and the right link block.
- In SPLIT, the left and right children blocks.

Author: Kirill Reshke <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Reviewed-by: Andrey Borodin <[email protected]>
Discussion: https://postgr.es/m/CALdSSPgnAt5L=D_xGXRXLYO5FK1H31_eYEESxdU1n-r4g+6GqA@mail.gmail.com

src/backend/access/rmgrdesc/gindesc.c

index 229675775ff9b2cc22030791a8c7906f48aecd0e..075c4a0ae93a0439335e45191fd81623b316dfbf 100644 (file)
@@ -130,6 +130,9 @@ gin_desc(StringInfo buf, XLogReaderState *record)
                appendStringInfo(buf, " isdata: %c isleaf: %c",
                                 (xlrec->flags & GIN_INSERT_ISDATA) ? 'T' : 'F',
                                 (xlrec->flags & GIN_INSERT_ISLEAF) ? 'T' : 'F');
+               if (xlrec->leftChildBlkno != InvalidBlockNumber)
+                   appendStringInfo(buf, " children: %u/%u",
+                                    xlrec->leftChildBlkno, xlrec->rightChildBlkno);
            }
            break;
        case XLOG_GIN_VACUUM_PAGE:
@@ -150,10 +153,27 @@ gin_desc(StringInfo buf, XLogReaderState *record)
            /* no further information */
            break;
        case XLOG_GIN_UPDATE_META_PAGE:
-           /* no further information */
+           {
+               ginxlogUpdateMeta *xlrec = (ginxlogUpdateMeta *) rec;
+
+               appendStringInfo(buf, "ntuples: %d", xlrec->ntuples);
+               if (xlrec->prevTail != InvalidBlockNumber)
+                   appendStringInfo(buf, " prevTail: %u",
+                                    xlrec->prevTail);
+               if (xlrec->newRightlink != InvalidBlockNumber)
+                   appendStringInfo(buf, " newRightLink: %u",
+                                    xlrec->newRightlink);
+           }
            break;
        case XLOG_GIN_INSERT_LISTPAGE:
-           /* no further information */
+           {
+               ginxlogInsertListPage *xlrec = (ginxlogInsertListPage *) rec;
+
+               appendStringInfo(buf, "ntuples: %d", xlrec->ntuples);
+               if (xlrec->rightlink != InvalidBlockNumber)
+                   appendStringInfo(buf, " rightlink: %u",
+                                    xlrec->rightlink);
+           }
            break;
        case XLOG_GIN_DELETE_LISTPAGE:
            appendStringInfo(buf, "ndeleted: %d",