LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - spgdesc.c (source / functions) Coverage Total Hit
Test: PostgreSQL 19devel Lines: 18.7 % 107 20
Test Date: 2026-02-27 11:14:44 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /*-------------------------------------------------------------------------
       2              :  *
       3              :  * spgdesc.c
       4              :  *    rmgr descriptor routines for access/spgist/spgxlog.c
       5              :  *
       6              :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
       7              :  * Portions Copyright (c) 1994, Regents of the University of California
       8              :  *
       9              :  *
      10              :  * IDENTIFICATION
      11              :  *    src/backend/access/rmgrdesc/spgdesc.c
      12              :  *
      13              :  *-------------------------------------------------------------------------
      14              :  */
      15              : #include "postgres.h"
      16              : 
      17              : #include "access/spgxlog.h"
      18              : 
      19              : void
      20           18 : spg_desc(StringInfo buf, XLogReaderState *record)
      21              : {
      22           18 :     char       *rec = XLogRecGetData(record);
      23           18 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      24              : 
      25           18 :     switch (info)
      26              :     {
      27           18 :         case XLOG_SPGIST_ADD_LEAF:
      28              :             {
      29           18 :                 spgxlogAddLeaf *xlrec = (spgxlogAddLeaf *) rec;
      30              : 
      31           18 :                 appendStringInfo(buf, "off: %u, headoff: %u, parentoff: %u, nodeI: %u",
      32           18 :                                  xlrec->offnumLeaf, xlrec->offnumHeadLeaf,
      33           18 :                                  xlrec->offnumParent, xlrec->nodeI);
      34           18 :                 if (xlrec->newPage)
      35            0 :                     appendStringInfoString(buf, " (newpage)");
      36           18 :                 if (xlrec->storesNulls)
      37            0 :                     appendStringInfoString(buf, " (nulls)");
      38              :             }
      39           18 :             break;
      40            0 :         case XLOG_SPGIST_MOVE_LEAFS:
      41              :             {
      42            0 :                 spgxlogMoveLeafs *xlrec = (spgxlogMoveLeafs *) rec;
      43              : 
      44            0 :                 appendStringInfo(buf, "nmoves: %u, parentoff: %u, nodeI: %u",
      45            0 :                                  xlrec->nMoves,
      46            0 :                                  xlrec->offnumParent, xlrec->nodeI);
      47            0 :                 if (xlrec->newPage)
      48            0 :                     appendStringInfoString(buf, " (newpage)");
      49            0 :                 if (xlrec->replaceDead)
      50            0 :                     appendStringInfoString(buf, " (replacedead)");
      51            0 :                 if (xlrec->storesNulls)
      52            0 :                     appendStringInfoString(buf, " (nulls)");
      53              :             }
      54            0 :             break;
      55            0 :         case XLOG_SPGIST_ADD_NODE:
      56              :             {
      57            0 :                 spgxlogAddNode *xlrec = (spgxlogAddNode *) rec;
      58              : 
      59            0 :                 appendStringInfo(buf, "off: %u, newoff: %u, parentBlk: %d, "
      60              :                                  "parentoff: %u, nodeI: %u",
      61            0 :                                  xlrec->offnum,
      62            0 :                                  xlrec->offnumNew,
      63            0 :                                  xlrec->parentBlk,
      64            0 :                                  xlrec->offnumParent,
      65            0 :                                  xlrec->nodeI);
      66            0 :                 if (xlrec->newPage)
      67            0 :                     appendStringInfoString(buf, " (newpage)");
      68              :             }
      69            0 :             break;
      70            0 :         case XLOG_SPGIST_SPLIT_TUPLE:
      71              :             {
      72            0 :                 spgxlogSplitTuple *xlrec = (spgxlogSplitTuple *) rec;
      73              : 
      74            0 :                 appendStringInfo(buf, "prefixoff: %u, postfixoff: %u",
      75            0 :                                  xlrec->offnumPrefix,
      76            0 :                                  xlrec->offnumPostfix);
      77            0 :                 if (xlrec->newPage)
      78            0 :                     appendStringInfoString(buf, " (newpage)");
      79            0 :                 if (xlrec->postfixBlkSame)
      80            0 :                     appendStringInfoString(buf, " (same)");
      81              :             }
      82            0 :             break;
      83            0 :         case XLOG_SPGIST_PICKSPLIT:
      84              :             {
      85            0 :                 spgxlogPickSplit *xlrec = (spgxlogPickSplit *) rec;
      86              : 
      87            0 :                 appendStringInfo(buf, "ndelete: %u, ninsert: %u, inneroff: %u, "
      88              :                                  "parentoff: %u, nodeI: %u",
      89            0 :                                  xlrec->nDelete, xlrec->nInsert,
      90            0 :                                  xlrec->offnumInner,
      91            0 :                                  xlrec->offnumParent, xlrec->nodeI);
      92            0 :                 if (xlrec->innerIsParent)
      93            0 :                     appendStringInfoString(buf, " (innerIsParent)");
      94            0 :                 if (xlrec->storesNulls)
      95            0 :                     appendStringInfoString(buf, " (nulls)");
      96            0 :                 if (xlrec->isRootSplit)
      97            0 :                     appendStringInfoString(buf, " (isRootSplit)");
      98              :             }
      99            0 :             break;
     100            0 :         case XLOG_SPGIST_VACUUM_LEAF:
     101              :             {
     102            0 :                 spgxlogVacuumLeaf *xlrec = (spgxlogVacuumLeaf *) rec;
     103              : 
     104            0 :                 appendStringInfo(buf, "ndead: %u, nplaceholder: %u, nmove: %u, nchain: %u",
     105            0 :                                  xlrec->nDead, xlrec->nPlaceholder,
     106            0 :                                  xlrec->nMove, xlrec->nChain);
     107              :             }
     108            0 :             break;
     109            0 :         case XLOG_SPGIST_VACUUM_ROOT:
     110              :             {
     111            0 :                 spgxlogVacuumRoot *xlrec = (spgxlogVacuumRoot *) rec;
     112              : 
     113            0 :                 appendStringInfo(buf, "ndelete: %u",
     114            0 :                                  xlrec->nDelete);
     115              :             }
     116            0 :             break;
     117            0 :         case XLOG_SPGIST_VACUUM_REDIRECT:
     118              :             {
     119            0 :                 spgxlogVacuumRedirect *xlrec = (spgxlogVacuumRedirect *) rec;
     120              : 
     121            0 :                 appendStringInfo(buf, "ntoplaceholder: %u, firstplaceholder: %u, snapshotConflictHorizon: %u, isCatalogRel: %c",
     122            0 :                                  xlrec->nToPlaceholder,
     123            0 :                                  xlrec->firstPlaceholder,
     124              :                                  xlrec->snapshotConflictHorizon,
     125            0 :                                  xlrec->isCatalogRel ? 'T' : 'F');
     126              :             }
     127            0 :             break;
     128              :     }
     129           18 : }
     130              : 
     131              : const char *
     132           19 : spg_identify(uint8 info)
     133              : {
     134           19 :     const char *id = NULL;
     135              : 
     136           19 :     switch (info & ~XLR_INFO_MASK)
     137              :     {
     138           19 :         case XLOG_SPGIST_ADD_LEAF:
     139           19 :             id = "ADD_LEAF";
     140           19 :             break;
     141            0 :         case XLOG_SPGIST_MOVE_LEAFS:
     142            0 :             id = "MOVE_LEAFS";
     143            0 :             break;
     144            0 :         case XLOG_SPGIST_ADD_NODE:
     145            0 :             id = "ADD_NODE";
     146            0 :             break;
     147            0 :         case XLOG_SPGIST_SPLIT_TUPLE:
     148            0 :             id = "SPLIT_TUPLE";
     149            0 :             break;
     150            0 :         case XLOG_SPGIST_PICKSPLIT:
     151            0 :             id = "PICKSPLIT";
     152            0 :             break;
     153            0 :         case XLOG_SPGIST_VACUUM_LEAF:
     154            0 :             id = "VACUUM_LEAF";
     155            0 :             break;
     156            0 :         case XLOG_SPGIST_VACUUM_ROOT:
     157            0 :             id = "VACUUM_ROOT";
     158            0 :             break;
     159            0 :         case XLOG_SPGIST_VACUUM_REDIRECT:
     160            0 :             id = "VACUUM_REDIRECT";
     161            0 :             break;
     162              :     }
     163              : 
     164           19 :     return id;
     165              : }
        

Generated by: LCOV version 2.0-1