LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - gistdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 0 50 0.0 %
Date: 2019-09-19 02:07:14 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * gistdesc.c
       4             :  *    rmgr descriptor routines for access/gist/gistxlog.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/gistdesc.c
      12             :  *
      13             :  *-------------------------------------------------------------------------
      14             :  */
      15             : #include "postgres.h"
      16             : 
      17             : #include "access/gistxlog.h"
      18             : #include "lib/stringinfo.h"
      19             : #include "storage/relfilenode.h"
      20             : 
      21             : static void
      22           0 : out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
      23             : {
      24           0 : }
      25             : 
      26             : static void
      27           0 : out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
      28             : {
      29           0 :     appendStringInfo(buf, "rel %u/%u/%u; blk %u; latestRemovedXid %u:%u",
      30             :                      xlrec->node.spcNode, xlrec->node.dbNode,
      31             :                      xlrec->node.relNode, xlrec->block,
      32           0 :                      EpochFromFullTransactionId(xlrec->latestRemovedFullXid),
      33           0 :                      XidFromFullTransactionId(xlrec->latestRemovedFullXid));
      34           0 : }
      35             : 
      36             : static void
      37           0 : out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
      38             : {
      39           0 :     appendStringInfo(buf, "delete: latestRemovedXid %u, nitems: %u",
      40           0 :                      xlrec->latestRemovedXid, xlrec->ntodelete);
      41             : 
      42           0 : }
      43             : 
      44             : static void
      45           0 : out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
      46             : {
      47           0 :     appendStringInfo(buf, "page_split: splits to %d pages",
      48           0 :                      xlrec->npage);
      49           0 : }
      50             : 
      51             : static void
      52           0 : out_gistxlogPageDelete(StringInfo buf, gistxlogPageDelete *xlrec)
      53             : {
      54           0 :     appendStringInfo(buf, "deleteXid %u:%u; downlink %u",
      55           0 :                      EpochFromFullTransactionId(xlrec->deleteXid),
      56           0 :                      XidFromFullTransactionId(xlrec->deleteXid),
      57           0 :                      xlrec->downlinkOffset);
      58           0 : }
      59             : 
      60             : void
      61           0 : gist_desc(StringInfo buf, XLogReaderState *record)
      62             : {
      63           0 :     char       *rec = XLogRecGetData(record);
      64           0 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      65             : 
      66           0 :     switch (info)
      67             :     {
      68             :         case XLOG_GIST_PAGE_UPDATE:
      69           0 :             out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
      70           0 :             break;
      71             :         case XLOG_GIST_PAGE_REUSE:
      72           0 :             out_gistxlogPageReuse(buf, (gistxlogPageReuse *) rec);
      73           0 :             break;
      74             :         case XLOG_GIST_DELETE:
      75           0 :             out_gistxlogDelete(buf, (gistxlogDelete *) rec);
      76           0 :             break;
      77             :         case XLOG_GIST_PAGE_SPLIT:
      78           0 :             out_gistxlogPageSplit(buf, (gistxlogPageSplit *) rec);
      79           0 :             break;
      80             :         case XLOG_GIST_PAGE_DELETE:
      81           0 :             out_gistxlogPageDelete(buf, (gistxlogPageDelete *) rec);
      82           0 :             break;
      83             :     }
      84           0 : }
      85             : 
      86             : const char *
      87           0 : gist_identify(uint8 info)
      88             : {
      89           0 :     const char *id = NULL;
      90             : 
      91           0 :     switch (info & ~XLR_INFO_MASK)
      92             :     {
      93             :         case XLOG_GIST_PAGE_UPDATE:
      94           0 :             id = "PAGE_UPDATE";
      95           0 :             break;
      96             :         case XLOG_GIST_DELETE:
      97           0 :             id = "DELETE";
      98           0 :             break;
      99             :         case XLOG_GIST_PAGE_REUSE:
     100           0 :             id = "PAGE_REUSE";
     101           0 :             break;
     102             :         case XLOG_GIST_PAGE_SPLIT:
     103           0 :             id = "PAGE_SPLIT";
     104           0 :             break;
     105             :         case XLOG_GIST_PAGE_DELETE:
     106           0 :             id = "PAGE_DELETE";
     107           0 :             break;
     108             :     }
     109             : 
     110           0 :     return id;
     111             : }

Generated by: LCOV version 1.13