LCOV - code coverage report
Current view: top level - src/backend/access/rmgrdesc - committsdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL Lines: 0 28 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             :  * committsdesc.c
       4             :  *    rmgr descriptor routines for access/transam/commit_ts.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/committsdesc.c
      12             :  *
      13             :  *-------------------------------------------------------------------------
      14             :  */
      15             : #include "postgres.h"
      16             : 
      17             : #include "access/commit_ts.h"
      18             : #include "utils/timestamp.h"
      19             : 
      20             : 
      21             : void
      22           0 : commit_ts_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 == COMMIT_TS_ZEROPAGE)
      28             :     {
      29             :         int         pageno;
      30             : 
      31           0 :         memcpy(&pageno, rec, sizeof(int));
      32           0 :         appendStringInfo(buf, "%d", pageno);
      33             :     }
      34           0 :     else if (info == COMMIT_TS_TRUNCATE)
      35             :     {
      36           0 :         xl_commit_ts_truncate *trunc = (xl_commit_ts_truncate *) rec;
      37             : 
      38           0 :         appendStringInfo(buf, "pageno %d, oldestXid %u",
      39             :                          trunc->pageno, trunc->oldestXid);
      40             :     }
      41           0 :     else if (info == COMMIT_TS_SETTS)
      42             :     {
      43           0 :         xl_commit_ts_set *xlrec = (xl_commit_ts_set *) rec;
      44             :         int         nsubxids;
      45             : 
      46           0 :         appendStringInfo(buf, "set %s/%d for: %u",
      47             :                          timestamptz_to_str(xlrec->timestamp),
      48           0 :                          xlrec->nodeid,
      49             :                          xlrec->mainxid);
      50           0 :         nsubxids = ((XLogRecGetDataLen(record) - SizeOfCommitTsSet) /
      51             :                     sizeof(TransactionId));
      52           0 :         if (nsubxids > 0)
      53             :         {
      54             :             int         i;
      55             :             TransactionId *subxids;
      56             : 
      57           0 :             subxids = palloc(sizeof(TransactionId) * nsubxids);
      58           0 :             memcpy(subxids,
      59           0 :                    XLogRecGetData(record) + SizeOfCommitTsSet,
      60             :                    sizeof(TransactionId) * nsubxids);
      61           0 :             for (i = 0; i < nsubxids; i++)
      62           0 :                 appendStringInfo(buf, ", %u", subxids[i]);
      63           0 :             pfree(subxids);
      64             :         }
      65             :     }
      66           0 : }
      67             : 
      68             : const char *
      69           0 : commit_ts_identify(uint8 info)
      70             : {
      71           0 :     switch (info)
      72             :     {
      73             :         case COMMIT_TS_ZEROPAGE:
      74           0 :             return "ZEROPAGE";
      75             :         case COMMIT_TS_TRUNCATE:
      76           0 :             return "TRUNCATE";
      77             :         case COMMIT_TS_SETTS:
      78           0 :             return "SETTS";
      79             :         default:
      80           0 :             return NULL;
      81             :     }
      82             : }

Generated by: LCOV version 1.11