PostgreSQL Source Code git master
Loading...
Searching...
No Matches
mxactdesc.c File Reference
#include "postgres.h"
#include "access/multixact.h"
Include dependency graph for mxactdesc.c:

Go to the source code of this file.

Functions

static void out_member (StringInfo buf, MultiXactMember *member)
 
void multixact_desc (StringInfo buf, XLogReaderState *record)
 
const charmultixact_identify (uint8 info)
 

Function Documentation

◆ multixact_desc()

void multixact_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 50 of file mxactdesc.c.

51{
52 char *rec = XLogRecGetData(record);
53 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
54
55 if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE ||
57 {
58 int64 pageno;
59
60 memcpy(&pageno, rec, sizeof(pageno));
61 appendStringInfo(buf, "%" PRId64, pageno);
62 }
63 else if (info == XLOG_MULTIXACT_CREATE_ID)
64 {
66 int i;
67
68 appendStringInfo(buf, "%u offset %" PRIu64 " nmembers %d: ", xlrec->mid,
69 xlrec->moff, xlrec->nmembers);
70 for (i = 0; i < xlrec->nmembers; i++)
71 out_member(buf, &xlrec->members[i]);
72 }
73 else if (info == XLOG_MULTIXACT_TRUNCATE_ID)
74 {
76
77 appendStringInfo(buf, "oldestMulti %u, oldestOffset %" PRIu64,
78 xlrec->oldestMulti, xlrec->oldestOffset);
79 }
80}
uint8_t uint8
Definition c.h:544
int64_t int64
Definition c.h:543
int i
Definition isn.c:77
#define XLOG_MULTIXACT_ZERO_MEM_PAGE
Definition multixact.h:68
#define XLOG_MULTIXACT_ZERO_OFF_PAGE
Definition multixact.h:67
#define XLOG_MULTIXACT_TRUNCATE_ID
Definition multixact.h:70
#define XLOG_MULTIXACT_CREATE_ID
Definition multixact.h:69
static void out_member(StringInfo buf, MultiXactMember *member)
Definition mxactdesc.c:20
static char buf[DEFAULT_XLOG_SEG_SIZE]
static int fb(int x)
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition stringinfo.c:145
#define XLogRecGetInfo(decoder)
Definition xlogreader.h:409
#define XLogRecGetData(decoder)
Definition xlogreader.h:414

References appendStringInfo(), buf, fb(), i, out_member(), XLOG_MULTIXACT_CREATE_ID, XLOG_MULTIXACT_TRUNCATE_ID, XLOG_MULTIXACT_ZERO_MEM_PAGE, XLOG_MULTIXACT_ZERO_OFF_PAGE, XLogRecGetData, and XLogRecGetInfo.

◆ multixact_identify()

const char * multixact_identify ( uint8  info)

Definition at line 83 of file mxactdesc.c.

84{
85 const char *id = NULL;
86
87 switch (info & ~XLR_INFO_MASK)
88 {
90 id = "ZERO_OFF_PAGE";
91 break;
93 id = "ZERO_MEM_PAGE";
94 break;
96 id = "CREATE_ID";
97 break;
99 id = "TRUNCATE_ID";
100 break;
101 }
102
103 return id;
104}
#define XLR_INFO_MASK
Definition xlogrecord.h:62

References fb(), XLOG_MULTIXACT_CREATE_ID, XLOG_MULTIXACT_TRUNCATE_ID, XLOG_MULTIXACT_ZERO_MEM_PAGE, XLOG_MULTIXACT_ZERO_OFF_PAGE, and XLR_INFO_MASK.

◆ out_member()

static void out_member ( StringInfo  buf,
MultiXactMember member 
)
static

Definition at line 20 of file mxactdesc.c.

21{
22 appendStringInfo(buf, "%u ", member->xid);
23 switch (member->status)
24 {
26 appendStringInfoString(buf, "(keysh) ");
27 break;
30 break;
32 appendStringInfoString(buf, "(fornokeyupd) ");
33 break;
35 appendStringInfoString(buf, "(forupd) ");
36 break;
38 appendStringInfoString(buf, "(nokeyupd) ");
39 break;
41 appendStringInfoString(buf, "(upd) ");
42 break;
43 default:
44 appendStringInfoString(buf, "(unk) ");
45 break;
46 }
47}
@ MultiXactStatusForShare
Definition multixact.h:39
@ MultiXactStatusForNoKeyUpdate
Definition multixact.h:40
@ MultiXactStatusNoKeyUpdate
Definition multixact.h:43
@ MultiXactStatusUpdate
Definition multixact.h:45
@ MultiXactStatusForUpdate
Definition multixact.h:41
@ MultiXactStatusForKeyShare
Definition multixact.h:38
void appendStringInfoString(StringInfo str, const char *s)
Definition stringinfo.c:230
TransactionId xid
Definition multixact.h:57
MultiXactStatus status
Definition multixact.h:58

References appendStringInfo(), appendStringInfoString(), buf, MultiXactStatusForKeyShare, MultiXactStatusForNoKeyUpdate, MultiXactStatusForShare, MultiXactStatusForUpdate, MultiXactStatusNoKeyUpdate, MultiXactStatusUpdate, MultiXactMember::status, and MultiXactMember::xid.

Referenced by multixact_desc().