LCOV - code coverage report
Current view: top level - src/backend/access/rmgrdesc - nbtdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 15devel Lines: 0 103 0.0 %
Date: 2021-12-04 22:09:09 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * nbtdesc.c
       4             :  *    rmgr descriptor routines for access/nbtree/nbtxlog.c
       5             :  *
       6             :  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
       7             :  * Portions Copyright (c) 1994, Regents of the University of California
       8             :  *
       9             :  *
      10             :  * IDENTIFICATION
      11             :  *    src/backend/access/rmgrdesc/nbtdesc.c
      12             :  *
      13             :  *-------------------------------------------------------------------------
      14             :  */
      15             : #include "postgres.h"
      16             : 
      17             : #include "access/nbtxlog.h"
      18             : 
      19             : void
      20           0 : btree_desc(StringInfo buf, XLogReaderState *record)
      21             : {
      22           0 :     char       *rec = XLogRecGetData(record);
      23           0 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      24             : 
      25           0 :     switch (info)
      26             :     {
      27           0 :         case XLOG_BTREE_INSERT_LEAF:
      28             :         case XLOG_BTREE_INSERT_UPPER:
      29             :         case XLOG_BTREE_INSERT_META:
      30             :         case XLOG_BTREE_INSERT_POST:
      31             :             {
      32           0 :                 xl_btree_insert *xlrec = (xl_btree_insert *) rec;
      33             : 
      34           0 :                 appendStringInfo(buf, "off %u", xlrec->offnum);
      35           0 :                 break;
      36             :             }
      37           0 :         case XLOG_BTREE_SPLIT_L:
      38             :         case XLOG_BTREE_SPLIT_R:
      39             :             {
      40           0 :                 xl_btree_split *xlrec = (xl_btree_split *) rec;
      41             : 
      42           0 :                 appendStringInfo(buf, "level %u, firstrightoff %d, newitemoff %d, postingoff %d",
      43           0 :                                  xlrec->level, xlrec->firstrightoff,
      44           0 :                                  xlrec->newitemoff, xlrec->postingoff);
      45           0 :                 break;
      46             :             }
      47           0 :         case XLOG_BTREE_DEDUP:
      48             :             {
      49           0 :                 xl_btree_dedup *xlrec = (xl_btree_dedup *) rec;
      50             : 
      51           0 :                 appendStringInfo(buf, "nintervals %u", xlrec->nintervals);
      52           0 :                 break;
      53             :             }
      54           0 :         case XLOG_BTREE_VACUUM:
      55             :             {
      56           0 :                 xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
      57             : 
      58           0 :                 appendStringInfo(buf, "ndeleted %u; nupdated %u",
      59           0 :                                  xlrec->ndeleted, xlrec->nupdated);
      60           0 :                 break;
      61             :             }
      62           0 :         case XLOG_BTREE_DELETE:
      63             :             {
      64           0 :                 xl_btree_delete *xlrec = (xl_btree_delete *) rec;
      65             : 
      66           0 :                 appendStringInfo(buf, "latestRemovedXid %u; ndeleted %u; nupdated %u",
      67           0 :                                  xlrec->latestRemovedXid, xlrec->ndeleted, xlrec->nupdated);
      68           0 :                 break;
      69             :             }
      70           0 :         case XLOG_BTREE_MARK_PAGE_HALFDEAD:
      71             :             {
      72           0 :                 xl_btree_mark_page_halfdead *xlrec = (xl_btree_mark_page_halfdead *) rec;
      73             : 
      74           0 :                 appendStringInfo(buf, "topparent %u; leaf %u; left %u; right %u",
      75             :                                  xlrec->topparent, xlrec->leafblk, xlrec->leftblk, xlrec->rightblk);
      76           0 :                 break;
      77             :             }
      78           0 :         case XLOG_BTREE_UNLINK_PAGE_META:
      79             :         case XLOG_BTREE_UNLINK_PAGE:
      80             :             {
      81           0 :                 xl_btree_unlink_page *xlrec = (xl_btree_unlink_page *) rec;
      82             : 
      83           0 :                 appendStringInfo(buf, "left %u; right %u; level %u; safexid %u:%u; ",
      84             :                                  xlrec->leftsib, xlrec->rightsib, xlrec->level,
      85           0 :                                  EpochFromFullTransactionId(xlrec->safexid),
      86           0 :                                  XidFromFullTransactionId(xlrec->safexid));
      87           0 :                 appendStringInfo(buf, "leafleft %u; leafright %u; leaftopparent %u",
      88             :                                  xlrec->leafleftsib, xlrec->leafrightsib,
      89             :                                  xlrec->leaftopparent);
      90           0 :                 break;
      91             :             }
      92           0 :         case XLOG_BTREE_NEWROOT:
      93             :             {
      94           0 :                 xl_btree_newroot *xlrec = (xl_btree_newroot *) rec;
      95             : 
      96           0 :                 appendStringInfo(buf, "lev %u", xlrec->level);
      97           0 :                 break;
      98             :             }
      99           0 :         case XLOG_BTREE_REUSE_PAGE:
     100             :             {
     101           0 :                 xl_btree_reuse_page *xlrec = (xl_btree_reuse_page *) rec;
     102             : 
     103           0 :                 appendStringInfo(buf, "rel %u/%u/%u; latestRemovedXid %u:%u",
     104             :                                  xlrec->node.spcNode, xlrec->node.dbNode,
     105             :                                  xlrec->node.relNode,
     106           0 :                                  EpochFromFullTransactionId(xlrec->latestRemovedFullXid),
     107           0 :                                  XidFromFullTransactionId(xlrec->latestRemovedFullXid));
     108           0 :                 break;
     109             :             }
     110           0 :         case XLOG_BTREE_META_CLEANUP:
     111             :             {
     112             :                 xl_btree_metadata *xlrec;
     113             : 
     114           0 :                 xlrec = (xl_btree_metadata *) XLogRecGetBlockData(record, 0,
     115             :                                                                   NULL);
     116           0 :                 appendStringInfo(buf, "last_cleanup_num_delpages %u",
     117             :                                  xlrec->last_cleanup_num_delpages);
     118           0 :                 break;
     119             :             }
     120             :     }
     121           0 : }
     122             : 
     123             : const char *
     124           0 : btree_identify(uint8 info)
     125             : {
     126           0 :     const char *id = NULL;
     127             : 
     128           0 :     switch (info & ~XLR_INFO_MASK)
     129             :     {
     130           0 :         case XLOG_BTREE_INSERT_LEAF:
     131           0 :             id = "INSERT_LEAF";
     132           0 :             break;
     133           0 :         case XLOG_BTREE_INSERT_UPPER:
     134           0 :             id = "INSERT_UPPER";
     135           0 :             break;
     136           0 :         case XLOG_BTREE_INSERT_META:
     137           0 :             id = "INSERT_META";
     138           0 :             break;
     139           0 :         case XLOG_BTREE_SPLIT_L:
     140           0 :             id = "SPLIT_L";
     141           0 :             break;
     142           0 :         case XLOG_BTREE_SPLIT_R:
     143           0 :             id = "SPLIT_R";
     144           0 :             break;
     145           0 :         case XLOG_BTREE_INSERT_POST:
     146           0 :             id = "INSERT_POST";
     147           0 :             break;
     148           0 :         case XLOG_BTREE_DEDUP:
     149           0 :             id = "DEDUP";
     150           0 :             break;
     151           0 :         case XLOG_BTREE_VACUUM:
     152           0 :             id = "VACUUM";
     153           0 :             break;
     154           0 :         case XLOG_BTREE_DELETE:
     155           0 :             id = "DELETE";
     156           0 :             break;
     157           0 :         case XLOG_BTREE_MARK_PAGE_HALFDEAD:
     158           0 :             id = "MARK_PAGE_HALFDEAD";
     159           0 :             break;
     160           0 :         case XLOG_BTREE_UNLINK_PAGE:
     161           0 :             id = "UNLINK_PAGE";
     162           0 :             break;
     163           0 :         case XLOG_BTREE_UNLINK_PAGE_META:
     164           0 :             id = "UNLINK_PAGE_META";
     165           0 :             break;
     166           0 :         case XLOG_BTREE_NEWROOT:
     167           0 :             id = "NEWROOT";
     168           0 :             break;
     169           0 :         case XLOG_BTREE_REUSE_PAGE:
     170           0 :             id = "REUSE_PAGE";
     171           0 :             break;
     172           0 :         case XLOG_BTREE_META_CLEANUP:
     173           0 :             id = "META_CLEANUP";
     174           0 :             break;
     175             :     }
     176             : 
     177           0 :     return id;
     178             : }

Generated by: LCOV version 1.14