Branch data Line data Source code
1 : : /*-------------------------------------------------------------------------
2 : : *
3 : : * spgdesc.c
4 : : * rmgr descriptor routines for access/spgist/spgxlog.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/spgdesc.c
12 : : *
13 : : *-------------------------------------------------------------------------
14 : : */
15 : : #include "postgres.h"
16 : :
17 : : #include "access/spgxlog.h"
18 : :
19 : : void
20 : 0 : spg_desc(StringInfo buf, XLogReaderState *record)
21 : : {
22 : 0 : char *rec = XLogRecGetData(record);
23 : 0 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
24 : :
25 [ # # # # : 0 : switch (info)
# # # #
# ]
26 : : {
27 : : case XLOG_SPGIST_ADD_LEAF:
28 : : {
29 : 0 : spgxlogAddLeaf *xlrec = (spgxlogAddLeaf *) rec;
30 : :
31 : 0 : appendStringInfo(buf, "off: %u, headoff: %u, parentoff: %u, nodeI: %u",
32 : 0 : xlrec->offnumLeaf, xlrec->offnumHeadLeaf,
33 : 0 : xlrec->offnumParent, xlrec->nodeI);
34 [ # # ]: 0 : if (xlrec->newPage)
35 : 0 : appendStringInfoString(buf, " (newpage)");
36 [ # # ]: 0 : if (xlrec->storesNulls)
37 : 0 : appendStringInfoString(buf, " (nulls)");
38 : 0 : }
39 : 0 : break;
40 : : case XLOG_SPGIST_MOVE_LEAFS:
41 : : {
42 : 0 : spgxlogMoveLeafs *xlrec = (spgxlogMoveLeafs *) rec;
43 : :
44 : 0 : appendStringInfo(buf, "nmoves: %u, parentoff: %u, nodeI: %u",
45 : 0 : xlrec->nMoves,
46 : 0 : xlrec->offnumParent, xlrec->nodeI);
47 [ # # ]: 0 : if (xlrec->newPage)
48 : 0 : appendStringInfoString(buf, " (newpage)");
49 [ # # ]: 0 : if (xlrec->replaceDead)
50 : 0 : appendStringInfoString(buf, " (replacedead)");
51 [ # # ]: 0 : if (xlrec->storesNulls)
52 : 0 : appendStringInfoString(buf, " (nulls)");
53 : 0 : }
54 : 0 : break;
55 : : case XLOG_SPGIST_ADD_NODE:
56 : : {
57 : 0 : spgxlogAddNode *xlrec = (spgxlogAddNode *) rec;
58 : :
59 : 0 : appendStringInfo(buf, "off: %u, newoff: %u, parentBlk: %d, "
60 : : "parentoff: %u, nodeI: %u",
61 : 0 : xlrec->offnum,
62 : 0 : xlrec->offnumNew,
63 : 0 : xlrec->parentBlk,
64 : 0 : xlrec->offnumParent,
65 : 0 : xlrec->nodeI);
66 [ # # ]: 0 : if (xlrec->newPage)
67 : 0 : appendStringInfoString(buf, " (newpage)");
68 : 0 : }
69 : 0 : break;
70 : : case XLOG_SPGIST_SPLIT_TUPLE:
71 : : {
72 : 0 : spgxlogSplitTuple *xlrec = (spgxlogSplitTuple *) rec;
73 : :
74 : 0 : appendStringInfo(buf, "prefixoff: %u, postfixoff: %u",
75 : 0 : xlrec->offnumPrefix,
76 : 0 : xlrec->offnumPostfix);
77 [ # # ]: 0 : if (xlrec->newPage)
78 : 0 : appendStringInfoString(buf, " (newpage)");
79 [ # # ]: 0 : if (xlrec->postfixBlkSame)
80 : 0 : appendStringInfoString(buf, " (same)");
81 : 0 : }
82 : 0 : break;
83 : : case XLOG_SPGIST_PICKSPLIT:
84 : : {
85 : 0 : spgxlogPickSplit *xlrec = (spgxlogPickSplit *) rec;
86 : :
87 : 0 : appendStringInfo(buf, "ndelete: %u, ninsert: %u, inneroff: %u, "
88 : : "parentoff: %u, nodeI: %u",
89 : 0 : xlrec->nDelete, xlrec->nInsert,
90 : 0 : xlrec->offnumInner,
91 : 0 : xlrec->offnumParent, xlrec->nodeI);
92 [ # # ]: 0 : if (xlrec->innerIsParent)
93 : 0 : appendStringInfoString(buf, " (innerIsParent)");
94 [ # # ]: 0 : if (xlrec->storesNulls)
95 : 0 : appendStringInfoString(buf, " (nulls)");
96 [ # # ]: 0 : if (xlrec->isRootSplit)
97 : 0 : appendStringInfoString(buf, " (isRootSplit)");
98 : 0 : }
99 : 0 : break;
100 : : case XLOG_SPGIST_VACUUM_LEAF:
101 : : {
102 : 0 : spgxlogVacuumLeaf *xlrec = (spgxlogVacuumLeaf *) rec;
103 : :
104 : 0 : appendStringInfo(buf, "ndead: %u, nplaceholder: %u, nmove: %u, nchain: %u",
105 : 0 : xlrec->nDead, xlrec->nPlaceholder,
106 : 0 : xlrec->nMove, xlrec->nChain);
107 : 0 : }
108 : 0 : break;
109 : : case XLOG_SPGIST_VACUUM_ROOT:
110 : : {
111 : 0 : spgxlogVacuumRoot *xlrec = (spgxlogVacuumRoot *) rec;
112 : :
113 : 0 : appendStringInfo(buf, "ndelete: %u",
114 : 0 : xlrec->nDelete);
115 : 0 : }
116 : 0 : break;
117 : : case XLOG_SPGIST_VACUUM_REDIRECT:
118 : : {
119 : 0 : spgxlogVacuumRedirect *xlrec = (spgxlogVacuumRedirect *) rec;
120 : :
121 : 0 : appendStringInfo(buf, "ntoplaceholder: %u, firstplaceholder: %u, snapshotConflictHorizon: %u, isCatalogRel: %c",
122 : 0 : xlrec->nToPlaceholder,
123 : 0 : xlrec->firstPlaceholder,
124 : 0 : xlrec->snapshotConflictHorizon,
125 : 0 : xlrec->isCatalogRel ? 'T' : 'F');
126 : 0 : }
127 : 0 : break;
128 : : }
129 : 0 : }
130 : :
131 : : const char *
132 : 0 : spg_identify(uint8 info)
133 : : {
134 : 0 : const char *id = NULL;
135 : :
136 [ # # # # : 0 : switch (info & ~XLR_INFO_MASK)
# # # #
# ]
137 : : {
138 : : case XLOG_SPGIST_ADD_LEAF:
139 : 0 : id = "ADD_LEAF";
140 : 0 : break;
141 : : case XLOG_SPGIST_MOVE_LEAFS:
142 : 0 : id = "MOVE_LEAFS";
143 : 0 : break;
144 : : case XLOG_SPGIST_ADD_NODE:
145 : 0 : id = "ADD_NODE";
146 : 0 : break;
147 : : case XLOG_SPGIST_SPLIT_TUPLE:
148 : 0 : id = "SPLIT_TUPLE";
149 : 0 : break;
150 : : case XLOG_SPGIST_PICKSPLIT:
151 : 0 : id = "PICKSPLIT";
152 : 0 : break;
153 : : case XLOG_SPGIST_VACUUM_LEAF:
154 : 0 : id = "VACUUM_LEAF";
155 : 0 : break;
156 : : case XLOG_SPGIST_VACUUM_ROOT:
157 : 0 : id = "VACUUM_ROOT";
158 : 0 : break;
159 : : case XLOG_SPGIST_VACUUM_REDIRECT:
160 : 0 : id = "VACUUM_REDIRECT";
161 : 0 : break;
162 : : }
163 : :
164 : 0 : return id;
165 : 0 : }
|