LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - gistdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 13beta1 Lines: 0 65 0.0 %
Date: 2020-06-03 11: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-2020, 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           0 :         case XLOG_GIST_PAGE_UPDATE:
      69           0 :             out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
      70           0 :             break;
      71           0 :         case XLOG_GIST_PAGE_REUSE:
      72           0 :             out_gistxlogPageReuse(buf, (gistxlogPageReuse *) rec);
      73           0 :             break;
      74           0 :         case XLOG_GIST_DELETE:
      75           0 :             out_gistxlogDelete(buf, (gistxlogDelete *) rec);
      76           0 :             break;
      77           0 :         case XLOG_GIST_PAGE_SPLIT:
      78           0 :             out_gistxlogPageSplit(buf, (gistxlogPageSplit *) rec);
      79           0 :             break;
      80           0 :         case XLOG_GIST_PAGE_DELETE:
      81           0 :             out_gistxlogPageDelete(buf, (gistxlogPageDelete *) rec);
      82           0 :             break;
      83           0 :         case XLOG_GIST_ASSIGN_LSN:
      84             :             /* No details to write out */
      85           0 :             break;
      86             :     }
      87           0 : }
      88             : 
      89             : const char *
      90           0 : gist_identify(uint8 info)
      91             : {
      92           0 :     const char *id = NULL;
      93             : 
      94           0 :     switch (info & ~XLR_INFO_MASK)
      95             :     {
      96           0 :         case XLOG_GIST_PAGE_UPDATE:
      97           0 :             id = "PAGE_UPDATE";
      98           0 :             break;
      99           0 :         case XLOG_GIST_DELETE:
     100           0 :             id = "DELETE";
     101           0 :             break;
     102           0 :         case XLOG_GIST_PAGE_REUSE:
     103           0 :             id = "PAGE_REUSE";
     104           0 :             break;
     105           0 :         case XLOG_GIST_PAGE_SPLIT:
     106           0 :             id = "PAGE_SPLIT";
     107           0 :             break;
     108           0 :         case XLOG_GIST_PAGE_DELETE:
     109           0 :             id = "PAGE_DELETE";
     110           0 :             break;
     111           0 :         case XLOG_GIST_ASSIGN_LSN:
     112           0 :             id = "ASSIGN_LSN";
     113           0 :             break;
     114             :     }
     115             : 
     116           0 :     return id;
     117             : }

Generated by: LCOV version 1.13