Branch data Line data Source code
1 : : /*-------------------------------------------------------------------------
2 : : *
3 : : * mxactdesc.c
4 : : * rmgr descriptor routines for access/transam/multixact.c
5 : : *
6 : : * Portions Copyright (c) 1996-2026, 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 : : case MultiXactStatusForKeyShare:
26 : 0 : appendStringInfoString(buf, "(keysh) ");
27 : 0 : break;
28 : : case MultiXactStatusForShare:
29 : 0 : appendStringInfoString(buf, "(sh) ");
30 : 0 : break;
31 : : case MultiXactStatusForNoKeyUpdate:
32 : 0 : appendStringInfoString(buf, "(fornokeyupd) ");
33 : 0 : break;
34 : : case MultiXactStatusForUpdate:
35 : 0 : appendStringInfoString(buf, "(forupd) ");
36 : 0 : break;
37 : : case MultiXactStatusNoKeyUpdate:
38 : 0 : appendStringInfoString(buf, "(nokeyupd) ");
39 : 0 : break;
40 : : case MultiXactStatusUpdate:
41 : 0 : appendStringInfoString(buf, "(upd) ");
42 : 0 : break;
43 : : 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 : 0 : info == XLOG_MULTIXACT_ZERO_MEM_PAGE)
57 : : {
58 : 0 : int64 pageno;
59 : :
60 : 0 : memcpy(&pageno, rec, sizeof(pageno));
61 : 0 : appendStringInfo(buf, "%" PRId64, pageno);
62 : 0 : }
63 [ # # ]: 0 : else if (info == XLOG_MULTIXACT_CREATE_ID)
64 : : {
65 : 0 : xl_multixact_create *xlrec = (xl_multixact_create *) rec;
66 : 0 : int i;
67 : :
68 : 0 : appendStringInfo(buf, "%u offset %" PRIu64 " nmembers %d: ", xlrec->mid,
69 : 0 : xlrec->moff, xlrec->nmembers);
70 [ # # ]: 0 : for (i = 0; i < xlrec->nmembers; i++)
71 : 0 : out_member(buf, &xlrec->members[i]);
72 : 0 : }
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, "oldestMulti %u, oldestOffset %" PRIu64,
78 : 0 : xlrec->oldestMulti, xlrec->oldestOffset);
79 : 0 : }
80 : 0 : }
81 : :
82 : : const char *
83 : 0 : multixact_identify(uint8 info)
84 : : {
85 : 0 : const char *id = NULL;
86 : :
87 [ # # # # : 0 : switch (info & ~XLR_INFO_MASK)
# ]
88 : : {
89 : : case XLOG_MULTIXACT_ZERO_OFF_PAGE:
90 : 0 : id = "ZERO_OFF_PAGE";
91 : 0 : break;
92 : : case XLOG_MULTIXACT_ZERO_MEM_PAGE:
93 : 0 : id = "ZERO_MEM_PAGE";
94 : 0 : break;
95 : : case XLOG_MULTIXACT_CREATE_ID:
96 : 0 : id = "CREATE_ID";
97 : 0 : break;
98 : : case XLOG_MULTIXACT_TRUNCATE_ID:
99 : 0 : id = "TRUNCATE_ID";
100 : 0 : break;
101 : : }
102 : :
103 : 0 : return id;
104 : 0 : }
|