LCOV - code coverage report
Current view: top level - src/backend/access/rmgrdesc - smgrdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL Lines: 0 22 0.0 %
Date: 2017-09-29 15:12:54 Functions: 0 2 0.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-2017, 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/catalog.h"
      18             : #include "catalog/storage_xlog.h"
      19             : 
      20             : 
      21             : void
      22           0 : smgr_desc(StringInfo buf, XLogReaderState *record)
      23             : {
      24           0 :     char       *rec = XLogRecGetData(record);
      25           0 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      26             : 
      27           0 :     if (info == XLOG_SMGR_CREATE)
      28             :     {
      29           0 :         xl_smgr_create *xlrec = (xl_smgr_create *) rec;
      30           0 :         char       *path = relpathperm(xlrec->rnode, xlrec->forkNum);
      31             : 
      32           0 :         appendStringInfoString(buf, path);
      33           0 :         pfree(path);
      34             :     }
      35           0 :     else if (info == XLOG_SMGR_TRUNCATE)
      36             :     {
      37           0 :         xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
      38           0 :         char       *path = relpathperm(xlrec->rnode, MAIN_FORKNUM);
      39             : 
      40           0 :         appendStringInfo(buf, "%s to %u blocks flags %d", path,
      41             :                          xlrec->blkno, xlrec->flags);
      42           0 :         pfree(path);
      43             :     }
      44           0 : }
      45             : 
      46             : const char *
      47           0 : smgr_identify(uint8 info)
      48             : {
      49           0 :     const char *id = NULL;
      50             : 
      51           0 :     switch (info & ~XLR_INFO_MASK)
      52             :     {
      53             :         case XLOG_SMGR_CREATE:
      54           0 :             id = "CREATE";
      55           0 :             break;
      56             :         case XLOG_SMGR_TRUNCATE:
      57           0 :             id = "TRUNCATE";
      58           0 :             break;
      59             :     }
      60             : 
      61           0 :     return id;
      62             : }

Generated by: LCOV version 1.11