LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - clogdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 18devel Lines: 14 21 66.7 %
Date: 2024-12-02 19:14:57 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * clogdesc.c
       4             :  *    rmgr descriptor routines for access/transam/clog.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/clogdesc.c
      12             :  *
      13             :  *-------------------------------------------------------------------------
      14             :  */
      15             : #include "postgres.h"
      16             : 
      17             : #include "access/clog.h"
      18             : 
      19             : 
      20             : void
      21           4 : clog_desc(StringInfo buf, XLogReaderState *record)
      22             : {
      23           4 :     char       *rec = XLogRecGetData(record);
      24           4 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      25             : 
      26           4 :     if (info == CLOG_ZEROPAGE)
      27             :     {
      28             :         int64       pageno;
      29             : 
      30           4 :         memcpy(&pageno, rec, sizeof(pageno));
      31           4 :         appendStringInfo(buf, "page %lld", (long long) pageno);
      32             :     }
      33           0 :     else if (info == CLOG_TRUNCATE)
      34             :     {
      35             :         xl_clog_truncate xlrec;
      36             : 
      37           0 :         memcpy(&xlrec, rec, sizeof(xl_clog_truncate));
      38           0 :         appendStringInfo(buf, "page %lld; oldestXact %u",
      39           0 :                          (long long) xlrec.pageno, xlrec.oldestXact);
      40             :     }
      41           4 : }
      42             : 
      43             : const char *
      44           4 : clog_identify(uint8 info)
      45             : {
      46           4 :     const char *id = NULL;
      47             : 
      48           4 :     switch (info & ~XLR_INFO_MASK)
      49             :     {
      50           4 :         case CLOG_ZEROPAGE:
      51           4 :             id = "ZEROPAGE";
      52           4 :             break;
      53           0 :         case CLOG_TRUNCATE:
      54           0 :             id = "TRUNCATE";
      55           0 :             break;
      56             :     }
      57             : 
      58           4 :     return id;
      59             : }

Generated by: LCOV version 1.14