LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - mxactdesc.c (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 0 57 0.0 %
Date: 2024-03-29 06:11:42 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * mxactdesc.c
       4             :  *    rmgr descriptor routines for access/transam/multixact.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/mxactdesc.c
      12             :  *
      13             :  *-------------------------------------------------------------------------
      14             :  */
      15             : #include "postgres.h"
      16             : 
      17             : #include "access/multixact.h"
      18             : 
      19             : static void
      20           0 : out_member(StringInfo buf, MultiXactMember *member)
      21             : {
      22           0 :     appendStringInfo(buf, "%u ", member->xid);
      23           0 :     switch (member->status)
      24             :     {
      25           0 :         case MultiXactStatusForKeyShare:
      26           0 :             appendStringInfoString(buf, "(keysh) ");
      27           0 :             break;
      28           0 :         case MultiXactStatusForShare:
      29           0 :             appendStringInfoString(buf, "(sh) ");
      30           0 :             break;
      31           0 :         case MultiXactStatusForNoKeyUpdate:
      32           0 :             appendStringInfoString(buf, "(fornokeyupd) ");
      33           0 :             break;
      34           0 :         case MultiXactStatusForUpdate:
      35           0 :             appendStringInfoString(buf, "(forupd) ");
      36           0 :             break;
      37           0 :         case MultiXactStatusNoKeyUpdate:
      38           0 :             appendStringInfoString(buf, "(nokeyupd) ");
      39           0 :             break;
      40           0 :         case MultiXactStatusUpdate:
      41           0 :             appendStringInfoString(buf, "(upd) ");
      42           0 :             break;
      43           0 :         default:
      44           0 :             appendStringInfoString(buf, "(unk) ");
      45           0 :             break;
      46             :     }
      47           0 : }
      48             : 
      49             : void
      50           0 : multixact_desc(StringInfo buf, XLogReaderState *record)
      51             : {
      52           0 :     char       *rec = XLogRecGetData(record);
      53           0 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      54             : 
      55           0 :     if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE ||
      56             :         info == XLOG_MULTIXACT_ZERO_MEM_PAGE)
      57           0 :     {
      58             :         int64       pageno;
      59             : 
      60           0 :         memcpy(&pageno, rec, sizeof(pageno));
      61           0 :         appendStringInfo(buf, "%lld", (long long) pageno);
      62             :     }
      63           0 :     else if (info == XLOG_MULTIXACT_CREATE_ID)
      64             :     {
      65           0 :         xl_multixact_create *xlrec = (xl_multixact_create *) rec;
      66             :         int         i;
      67             : 
      68           0 :         appendStringInfo(buf, "%u offset %u nmembers %d: ", xlrec->mid,
      69             :                          xlrec->moff, xlrec->nmembers);
      70           0 :         for (i = 0; i < xlrec->nmembers; i++)
      71           0 :             out_member(buf, &xlrec->members[i]);
      72             :     }
      73           0 :     else if (info == XLOG_MULTIXACT_TRUNCATE_ID)
      74             :     {
      75           0 :         xl_multixact_truncate *xlrec = (xl_multixact_truncate *) rec;
      76             : 
      77           0 :         appendStringInfo(buf, "offsets [%u, %u), members [%u, %u)",
      78             :                          xlrec->startTruncOff, xlrec->endTruncOff,
      79             :                          xlrec->startTruncMemb, xlrec->endTruncMemb);
      80             :     }
      81           0 : }
      82             : 
      83             : const char *
      84           0 : multixact_identify(uint8 info)
      85             : {
      86           0 :     const char *id = NULL;
      87             : 
      88           0 :     switch (info & ~XLR_INFO_MASK)
      89             :     {
      90           0 :         case XLOG_MULTIXACT_ZERO_OFF_PAGE:
      91           0 :             id = "ZERO_OFF_PAGE";
      92           0 :             break;
      93           0 :         case XLOG_MULTIXACT_ZERO_MEM_PAGE:
      94           0 :             id = "ZERO_MEM_PAGE";
      95           0 :             break;
      96           0 :         case XLOG_MULTIXACT_CREATE_ID:
      97           0 :             id = "CREATE_ID";
      98           0 :             break;
      99           0 :         case XLOG_MULTIXACT_TRUNCATE_ID:
     100           0 :             id = "TRUNCATE_ID";
     101           0 :             break;
     102             :     }
     103             : 
     104           0 :     return id;
     105             : }

Generated by: LCOV version 1.14