LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - gistdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 12beta2 Lines: 0 46 0.0 %
Date: 2019-06-19 16:07:09 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",
      30             :                      xlrec->node.spcNode, xlrec->node.dbNode,
      31             :                      xlrec->node.relNode, xlrec->block,
      32             :                      xlrec->latestRemovedXid);
      33           0 : }
      34             : 
      35             : static void
      36           0 : out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
      37             : {
      38           0 :     appendStringInfo(buf, "delete: latestRemovedXid %u, nitems: %u",
      39           0 :                      xlrec->latestRemovedXid, xlrec->ntodelete);
      40             : 
      41           0 : }
      42             : 
      43             : static void
      44           0 : out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
      45             : {
      46           0 :     appendStringInfo(buf, "page_split: splits to %d pages",
      47           0 :                      xlrec->npage);
      48           0 : }
      49             : 
      50             : static void
      51           0 : out_gistxlogPageDelete(StringInfo buf, gistxlogPageDelete *xlrec)
      52             : {
      53           0 :     appendStringInfo(buf, "deleteXid %u; downlink %u",
      54           0 :                      xlrec->deleteXid, xlrec->downlinkOffset);
      55           0 : }
      56             : 
      57             : void
      58           0 : gist_desc(StringInfo buf, XLogReaderState *record)
      59             : {
      60           0 :     char       *rec = XLogRecGetData(record);
      61           0 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      62             : 
      63           0 :     switch (info)
      64             :     {
      65             :         case XLOG_GIST_PAGE_UPDATE:
      66           0 :             out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
      67           0 :             break;
      68             :         case XLOG_GIST_PAGE_REUSE:
      69           0 :             out_gistxlogPageReuse(buf, (gistxlogPageReuse *) rec);
      70           0 :             break;
      71             :         case XLOG_GIST_DELETE:
      72           0 :             out_gistxlogDelete(buf, (gistxlogDelete *) rec);
      73           0 :             break;
      74             :         case XLOG_GIST_PAGE_SPLIT:
      75           0 :             out_gistxlogPageSplit(buf, (gistxlogPageSplit *) rec);
      76           0 :             break;
      77             :         case XLOG_GIST_PAGE_DELETE:
      78           0 :             out_gistxlogPageDelete(buf, (gistxlogPageDelete *) rec);
      79           0 :             break;
      80             :     }
      81           0 : }
      82             : 
      83             : const char *
      84           0 : gist_identify(uint8 info)
      85             : {
      86           0 :     const char *id = NULL;
      87             : 
      88           0 :     switch (info & ~XLR_INFO_MASK)
      89             :     {
      90             :         case XLOG_GIST_PAGE_UPDATE:
      91           0 :             id = "PAGE_UPDATE";
      92           0 :             break;
      93             :         case XLOG_GIST_DELETE:
      94           0 :             id = "DELETE";
      95           0 :             break;
      96             :         case XLOG_GIST_PAGE_REUSE:
      97           0 :             id = "PAGE_REUSE";
      98           0 :             break;
      99             :         case XLOG_GIST_PAGE_SPLIT:
     100           0 :             id = "PAGE_SPLIT";
     101           0 :             break;
     102             :         case XLOG_GIST_PAGE_DELETE:
     103           0 :             id = "PAGE_DELETE";
     104           0 :             break;
     105             :     }
     106             : 
     107           0 :     return id;
     108             : }

Generated by: LCOV version 1.13