LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - tblspcdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 20 20 100.0 %
Date: 2024-04-25 06:13:26 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * tblspcdesc.c
       4             :  *    rmgr descriptor routines for commands/tablespace.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/tblspcdesc.c
      12             :  *
      13             :  *-------------------------------------------------------------------------
      14             :  */
      15             : #include "postgres.h"
      16             : 
      17             : #include "commands/tablespace.h"
      18             : 
      19             : 
      20             : void
      21          24 : tblspc_desc(StringInfo buf, XLogReaderState *record)
      22             : {
      23          24 :     char       *rec = XLogRecGetData(record);
      24          24 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      25             : 
      26          24 :     if (info == XLOG_TBLSPC_CREATE)
      27             :     {
      28          12 :         xl_tblspc_create_rec *xlrec = (xl_tblspc_create_rec *) rec;
      29             : 
      30          12 :         appendStringInfo(buf, "%u \"%s\"", xlrec->ts_id, xlrec->ts_path);
      31             :     }
      32          12 :     else if (info == XLOG_TBLSPC_DROP)
      33             :     {
      34          12 :         xl_tblspc_drop_rec *xlrec = (xl_tblspc_drop_rec *) rec;
      35             : 
      36          12 :         appendStringInfo(buf, "%u", xlrec->ts_id);
      37             :     }
      38          24 : }
      39             : 
      40             : const char *
      41          28 : tblspc_identify(uint8 info)
      42             : {
      43          28 :     const char *id = NULL;
      44             : 
      45          28 :     switch (info & ~XLR_INFO_MASK)
      46             :     {
      47          14 :         case XLOG_TBLSPC_CREATE:
      48          14 :             id = "CREATE";
      49          14 :             break;
      50          14 :         case XLOG_TBLSPC_DROP:
      51          14 :             id = "DROP";
      52          14 :             break;
      53             :     }
      54             : 
      55          28 :     return id;
      56             : }

Generated by: LCOV version 1.14