LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - nbtdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 12beta2 Lines: 0 64 0.0 %
Date: 2019-06-18 07:06:57 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-2019, 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             :         case XLOG_BTREE_INSERT_LEAF:
      28             :         case XLOG_BTREE_INSERT_UPPER:
      29             :         case XLOG_BTREE_INSERT_META:
      30             :             {
      31           0 :                 xl_btree_insert *xlrec = (xl_btree_insert *) rec;
      32             : 
      33           0 :                 appendStringInfo(buf, "off %u", xlrec->offnum);
      34           0 :                 break;
      35             :             }
      36             :         case XLOG_BTREE_SPLIT_L:
      37             :         case XLOG_BTREE_SPLIT_R:
      38             :             {
      39           0 :                 xl_btree_split *xlrec = (xl_btree_split *) rec;
      40             : 
      41           0 :                 appendStringInfo(buf, "level %u, firstright %d",
      42           0 :                                  xlrec->level, xlrec->firstright);
      43           0 :                 break;
      44             :             }
      45             :         case XLOG_BTREE_VACUUM:
      46             :             {
      47           0 :                 xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
      48             : 
      49           0 :                 appendStringInfo(buf, "lastBlockVacuumed %u",
      50             :                                  xlrec->lastBlockVacuumed);
      51           0 :                 break;
      52             :             }
      53             :         case XLOG_BTREE_DELETE:
      54             :             {
      55           0 :                 xl_btree_delete *xlrec = (xl_btree_delete *) rec;
      56             : 
      57           0 :                 appendStringInfo(buf, "%d items, latest removed xid %u",
      58             :                                  xlrec->nitems, xlrec->latestRemovedXid);
      59           0 :                 break;
      60             :             }
      61             :         case XLOG_BTREE_MARK_PAGE_HALFDEAD:
      62             :             {
      63           0 :                 xl_btree_mark_page_halfdead *xlrec = (xl_btree_mark_page_halfdead *) rec;
      64             : 
      65           0 :                 appendStringInfo(buf, "topparent %u; leaf %u; left %u; right %u",
      66             :                                  xlrec->topparent, xlrec->leafblk, xlrec->leftblk, xlrec->rightblk);
      67           0 :                 break;
      68             :             }
      69             :         case XLOG_BTREE_UNLINK_PAGE_META:
      70             :         case XLOG_BTREE_UNLINK_PAGE:
      71             :             {
      72           0 :                 xl_btree_unlink_page *xlrec = (xl_btree_unlink_page *) rec;
      73             : 
      74           0 :                 appendStringInfo(buf, "left %u; right %u; btpo_xact %u; ",
      75             :                                  xlrec->leftsib, xlrec->rightsib,
      76             :                                  xlrec->btpo_xact);
      77           0 :                 appendStringInfo(buf, "leafleft %u; leafright %u; topparent %u",
      78             :                                  xlrec->leafleftsib, xlrec->leafrightsib,
      79             :                                  xlrec->topparent);
      80           0 :                 break;
      81             :             }
      82             :         case XLOG_BTREE_NEWROOT:
      83             :             {
      84           0 :                 xl_btree_newroot *xlrec = (xl_btree_newroot *) rec;
      85             : 
      86           0 :                 appendStringInfo(buf, "lev %u", xlrec->level);
      87           0 :                 break;
      88             :             }
      89             :         case XLOG_BTREE_REUSE_PAGE:
      90             :             {
      91           0 :                 xl_btree_reuse_page *xlrec = (xl_btree_reuse_page *) rec;
      92             : 
      93           0 :                 appendStringInfo(buf, "rel %u/%u/%u; latestRemovedXid %u",
      94             :                                  xlrec->node.spcNode, xlrec->node.dbNode,
      95             :                                  xlrec->node.relNode, xlrec->latestRemovedXid);
      96           0 :                 break;
      97             :             }
      98             :         case XLOG_BTREE_META_CLEANUP:
      99             :             {
     100           0 :                 xl_btree_metadata *xlrec = (xl_btree_metadata *) rec;
     101             : 
     102           0 :                 appendStringInfo(buf, "oldest_btpo_xact %u; last_cleanup_num_heap_tuples: %f",
     103             :                                  xlrec->oldest_btpo_xact,
     104             :                                  xlrec->last_cleanup_num_heap_tuples);
     105           0 :                 break;
     106             :             }
     107             :     }
     108           0 : }
     109             : 
     110             : const char *
     111           0 : btree_identify(uint8 info)
     112             : {
     113           0 :     const char *id = NULL;
     114             : 
     115           0 :     switch (info & ~XLR_INFO_MASK)
     116             :     {
     117             :         case XLOG_BTREE_INSERT_LEAF:
     118           0 :             id = "INSERT_LEAF";
     119           0 :             break;
     120             :         case XLOG_BTREE_INSERT_UPPER:
     121           0 :             id = "INSERT_UPPER";
     122           0 :             break;
     123             :         case XLOG_BTREE_INSERT_META:
     124           0 :             id = "INSERT_META";
     125           0 :             break;
     126             :         case XLOG_BTREE_SPLIT_L:
     127           0 :             id = "SPLIT_L";
     128           0 :             break;
     129             :         case XLOG_BTREE_SPLIT_R:
     130           0 :             id = "SPLIT_R";
     131           0 :             break;
     132             :         case XLOG_BTREE_VACUUM:
     133           0 :             id = "VACUUM";
     134           0 :             break;
     135             :         case XLOG_BTREE_DELETE:
     136           0 :             id = "DELETE";
     137           0 :             break;
     138             :         case XLOG_BTREE_MARK_PAGE_HALFDEAD:
     139           0 :             id = "MARK_PAGE_HALFDEAD";
     140           0 :             break;
     141             :         case XLOG_BTREE_UNLINK_PAGE:
     142           0 :             id = "UNLINK_PAGE";
     143           0 :             break;
     144             :         case XLOG_BTREE_UNLINK_PAGE_META:
     145           0 :             id = "UNLINK_PAGE_META";
     146           0 :             break;
     147             :         case XLOG_BTREE_NEWROOT:
     148           0 :             id = "NEWROOT";
     149           0 :             break;
     150             :         case XLOG_BTREE_REUSE_PAGE:
     151           0 :             id = "REUSE_PAGE";
     152           0 :             break;
     153             :         case XLOG_BTREE_META_CLEANUP:
     154           0 :             id = "META_CLEANUP";
     155           0 :             break;
     156             :     }
     157             : 
     158           0 :     return id;
     159             : }

Generated by: LCOV version 1.13