LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - smgrdesc.c (source / functions) Coverage Total Hit
Test: PostgreSQL 19devel Lines: 100.0 % 22 22
Test Date: 2026-02-17 17:20:33 Functions: 100.0 % 2 2
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-2026, 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         1993 : smgr_desc(StringInfo buf, XLogReaderState *record)
      22              : {
      23         1993 :     char       *rec = XLogRecGetData(record);
      24         1993 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      25              : 
      26         1993 :     if (info == XLOG_SMGR_CREATE)
      27              :     {
      28         1987 :         xl_smgr_create *xlrec = (xl_smgr_create *) rec;
      29              : 
      30         1987 :         appendStringInfoString(buf,
      31         1987 :                                relpathperm(xlrec->rlocator, xlrec->forkNum).str);
      32              :     }
      33            6 :     else if (info == XLOG_SMGR_TRUNCATE)
      34              :     {
      35            6 :         xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
      36              : 
      37            6 :         appendStringInfo(buf, "%s to %u blocks flags %d",
      38            6 :                          relpathperm(xlrec->rlocator, MAIN_FORKNUM).str,
      39              :                          xlrec->blkno, xlrec->flags);
      40              :     }
      41         1993 : }
      42              : 
      43              : const char *
      44         1995 : smgr_identify(uint8 info)
      45              : {
      46         1995 :     const char *id = NULL;
      47              : 
      48         1995 :     switch (info & ~XLR_INFO_MASK)
      49              :     {
      50         1988 :         case XLOG_SMGR_CREATE:
      51         1988 :             id = "CREATE";
      52         1988 :             break;
      53            7 :         case XLOG_SMGR_TRUNCATE:
      54            7 :             id = "TRUNCATE";
      55            7 :             break;
      56              :     }
      57              : 
      58         1995 :     return id;
      59              : }
        

Generated by: LCOV version 2.0-1