LCOV - code coverage report
Current view: top level - src/backend/access/rmgrdesc - gistdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 0 67 0.0 %
Date: 2024-03-28 10:11:15 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-2024, 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             : 
      20             : static void
      21           0 : out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
      22             : {
      23           0 : }
      24             : 
      25             : static void
      26           0 : out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
      27             : {
      28           0 :     appendStringInfo(buf, "rel %u/%u/%u; blk %u; snapshotConflictHorizon %u:%u, isCatalogRel %c",
      29             :                      xlrec->locator.spcOid, xlrec->locator.dbOid,
      30             :                      xlrec->locator.relNumber, xlrec->block,
      31           0 :                      EpochFromFullTransactionId(xlrec->snapshotConflictHorizon),
      32           0 :                      XidFromFullTransactionId(xlrec->snapshotConflictHorizon),
      33           0 :                      xlrec->isCatalogRel ? 'T' : 'F');
      34           0 : }
      35             : 
      36             : static void
      37           0 : out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
      38             : {
      39           0 :     appendStringInfo(buf, "delete: snapshotConflictHorizon %u, nitems: %u, isCatalogRel %c",
      40           0 :                      xlrec->snapshotConflictHorizon, xlrec->ntodelete,
      41           0 :                      xlrec->isCatalogRel ? 'T' : 'F');
      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.14