LCOV - code coverage report
Current view: top level - src/backend/access/rmgrdesc - smgrdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 18devel Lines: 15 22 68.2 %
Date: 2025-04-01 15:15:16 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * smgrdesc.c
       4             :  *    rmgr descriptor routines for catalog/storage.c
       5             :  *
       6             :  * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
       7             :  * Portions Copyright (c) 1994, Regents of the University of California
       8             :  *
       9             :  *
      10             :  * IDENTIFICATION
      11             :  *    src/backend/access/rmgrdesc/smgrdesc.c
      12             :  *
      13             :  *-------------------------------------------------------------------------
      14             :  */
      15             : #include "postgres.h"
      16             : 
      17             : #include "catalog/storage_xlog.h"
      18             : 
      19             : 
      20             : void
      21           2 : smgr_desc(StringInfo buf, XLogReaderState *record)
      22             : {
      23           2 :     char       *rec = XLogRecGetData(record);
      24           2 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      25             : 
      26           2 :     if (info == XLOG_SMGR_CREATE)
      27             :     {
      28           2 :         xl_smgr_create *xlrec = (xl_smgr_create *) rec;
      29             : 
      30           2 :         appendStringInfoString(buf,
      31           2 :                                relpathperm(xlrec->rlocator, xlrec->forkNum).str);
      32             :     }
      33           0 :     else if (info == XLOG_SMGR_TRUNCATE)
      34             :     {
      35           0 :         xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
      36             : 
      37           0 :         appendStringInfo(buf, "%s to %u blocks flags %d",
      38           0 :                          relpathperm(xlrec->rlocator, MAIN_FORKNUM).str,
      39             :                          xlrec->blkno, xlrec->flags);
      40             :     }
      41           2 : }
      42             : 
      43             : const char *
      44           2 : smgr_identify(uint8 info)
      45             : {
      46           2 :     const char *id = NULL;
      47             : 
      48           2 :     switch (info & ~XLR_INFO_MASK)
      49             :     {
      50           2 :         case XLOG_SMGR_CREATE:
      51           2 :             id = "CREATE";
      52           2 :             break;
      53           0 :         case XLOG_SMGR_TRUNCATE:
      54           0 :             id = "TRUNCATE";
      55           0 :             break;
      56             :     }
      57             : 
      58           2 :     return id;
      59             : }

Generated by: LCOV version 1.14