PostgreSQL Source Code  git master
spgdesc.c File Reference
#include "postgres.h"
#include "access/spgxlog.h"
Include dependency graph for spgdesc.c:

Go to the source code of this file.

Functions

void spg_desc (StringInfo buf, XLogReaderState *record)
 
const char * spg_identify (uint8 info)
 

Function Documentation

◆ spg_desc()

void spg_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 20 of file spgdesc.c.

References appendStringInfo(), appendStringInfoString(), spgxlogVacuumRedirect::firstPlaceholder, spgxlogPickSplit::innerIsParent, spgxlogPickSplit::isRootSplit, spgxlogVacuumLeaf::nChain, spgxlogVacuumLeaf::nDead, spgxlogPickSplit::nDelete, spgxlogVacuumRoot::nDelete, spgxlogVacuumRedirect::newestRedirectXid, spgxlogAddLeaf::newPage, spgxlogMoveLeafs::newPage, spgxlogAddNode::newPage, spgxlogSplitTuple::newPage, spgxlogPickSplit::nInsert, spgxlogVacuumLeaf::nMove, spgxlogMoveLeafs::nMoves, spgxlogAddLeaf::nodeI, spgxlogMoveLeafs::nodeI, spgxlogAddNode::nodeI, spgxlogPickSplit::nodeI, spgxlogVacuumLeaf::nPlaceholder, spgxlogVacuumRedirect::nToPlaceholder, spgxlogAddNode::offnum, spgxlogAddLeaf::offnumHeadLeaf, spgxlogPickSplit::offnumInner, spgxlogAddLeaf::offnumLeaf, spgxlogAddNode::offnumNew, spgxlogAddLeaf::offnumParent, spgxlogMoveLeafs::offnumParent, spgxlogAddNode::offnumParent, spgxlogPickSplit::offnumParent, spgxlogSplitTuple::offnumPostfix, spgxlogSplitTuple::offnumPrefix, spgxlogAddNode::parentBlk, spgxlogSplitTuple::postfixBlkSame, spgxlogMoveLeafs::replaceDead, spgxlogAddLeaf::storesNulls, spgxlogMoveLeafs::storesNulls, spgxlogPickSplit::storesNulls, XLOG_SPGIST_ADD_LEAF, XLOG_SPGIST_ADD_NODE, XLOG_SPGIST_MOVE_LEAFS, XLOG_SPGIST_PICKSPLIT, XLOG_SPGIST_SPLIT_TUPLE, XLOG_SPGIST_VACUUM_LEAF, XLOG_SPGIST_VACUUM_REDIRECT, XLOG_SPGIST_VACUUM_ROOT, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

21 {
22  char *rec = XLogRecGetData(record);
23  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
24 
25  switch (info)
26  {
28  {
29  spgxlogAddLeaf *xlrec = (spgxlogAddLeaf *) rec;
30 
31  appendStringInfo(buf, "off: %u, headoff: %u, parentoff: %u, nodeI: %u",
32  xlrec->offnumLeaf, xlrec->offnumHeadLeaf,
33  xlrec->offnumParent, xlrec->nodeI);
34  if (xlrec->newPage)
35  appendStringInfoString(buf, " (newpage)");
36  if (xlrec->storesNulls)
37  appendStringInfoString(buf, " (nulls)");
38  }
39  break;
41  {
42  spgxlogMoveLeafs *xlrec = (spgxlogMoveLeafs *) rec;
43 
44  appendStringInfo(buf, "nmoves: %u, parentoff: %u, nodeI: %u",
45  xlrec->nMoves,
46  xlrec->offnumParent, xlrec->nodeI);
47  if (xlrec->newPage)
48  appendStringInfoString(buf, " (newpage)");
49  if (xlrec->replaceDead)
50  appendStringInfoString(buf, " (replacedead)");
51  if (xlrec->storesNulls)
52  appendStringInfoString(buf, " (nulls)");
53  }
54  break;
56  {
57  spgxlogAddNode *xlrec = (spgxlogAddNode *) rec;
58 
59  appendStringInfo(buf, "off: %u, newoff: %u, parentBlk: %d, "
60  "parentoff: %u, nodeI: %u",
61  xlrec->offnum,
62  xlrec->offnumNew,
63  xlrec->parentBlk,
64  xlrec->offnumParent,
65  xlrec->nodeI);
66  if (xlrec->newPage)
67  appendStringInfoString(buf, " (newpage)");
68  }
69  break;
71  {
72  spgxlogSplitTuple *xlrec = (spgxlogSplitTuple *) rec;
73 
74  appendStringInfo(buf, "prefixoff: %u, postfixoff: %u",
75  xlrec->offnumPrefix,
76  xlrec->offnumPostfix);
77  if (xlrec->newPage)
78  appendStringInfoString(buf, " (newpage)");
79  if (xlrec->postfixBlkSame)
80  appendStringInfoString(buf, " (same)");
81  }
82  break;
84  {
85  spgxlogPickSplit *xlrec = (spgxlogPickSplit *) rec;
86 
87  appendStringInfo(buf, "ndelete: %u, ninsert: %u, inneroff: %u, "
88  "parentoff: %u, nodeI: %u",
89  xlrec->nDelete, xlrec->nInsert,
90  xlrec->offnumInner,
91  xlrec->offnumParent, xlrec->nodeI);
92  if (xlrec->innerIsParent)
93  appendStringInfoString(buf, " (innerIsParent)");
94  if (xlrec->storesNulls)
95  appendStringInfoString(buf, " (nulls)");
96  if (xlrec->isRootSplit)
97  appendStringInfoString(buf, " (isRootSplit)");
98  }
99  break;
101  {
102  spgxlogVacuumLeaf *xlrec = (spgxlogVacuumLeaf *) rec;
103 
104  appendStringInfo(buf, "ndead: %u, nplaceholder: %u, nmove: %u, nchain: %u",
105  xlrec->nDead, xlrec->nPlaceholder,
106  xlrec->nMove, xlrec->nChain);
107  }
108  break;
110  {
111  spgxlogVacuumRoot *xlrec = (spgxlogVacuumRoot *) rec;
112 
113  appendStringInfo(buf, "ndelete: %u",
114  xlrec->nDelete);
115  }
116  break;
118  {
120 
121  appendStringInfo(buf, "ntoplaceholder: %u, firstplaceholder: %u, newestredirectxid: %u",
122  xlrec->nToPlaceholder,
123  xlrec->firstPlaceholder,
124  xlrec->newestRedirectXid);
125  }
126  break;
127  }
128 }
#define XLOG_SPGIST_MOVE_LEAFS
Definition: spgxlog.h:23
#define XLOG_SPGIST_VACUUM_REDIRECT
Definition: spgxlog.h:29
OffsetNumber offnumPostfix
Definition: spgxlog.h:147
uint16 nDelete
Definition: spgxlog.h:169
OffsetNumber offnumParent
Definition: spgxlog.h:53
#define XLOG_SPGIST_SPLIT_TUPLE
Definition: spgxlog.h:25
OffsetNumber offnumLeaf
Definition: spgxlog.h:50
uint16 nodeI
Definition: spgxlog.h:73
OffsetNumber firstPlaceholder
Definition: spgxlog.h:241
unsigned char uint8
Definition: c.h:439
#define XLOG_SPGIST_ADD_NODE
Definition: spgxlog.h:24
uint16 nDelete
Definition: spgxlog.h:228
#define XLOG_SPGIST_ADD_LEAF
Definition: spgxlog.h:22
uint16 nInsert
Definition: spgxlog.h:170
bool innerIsParent
Definition: spgxlog.h:181
OffsetNumber offnum
Definition: spgxlog.h:105
OffsetNumber offnumInner
Definition: spgxlog.h:175
#define XLOG_SPGIST_PICKSPLIT
Definition: spgxlog.h:26
TransactionId newestRedirectXid
Definition: spgxlog.h:242
#define XLOG_SPGIST_VACUUM_ROOT
Definition: spgxlog.h:28
OffsetNumber offnumNew
Definition: spgxlog.h:111
#define XLogRecGetData(decoder)
Definition: xlogreader.h:310
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:91
bool newPage
Definition: spgxlog.h:48
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:176
OffsetNumber offnumParent
Definition: spgxlog.h:182
uint16 nodeI
Definition: spgxlog.h:183
bool replaceDead
Definition: spgxlog.h:68
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:305
int8 parentBlk
Definition: spgxlog.h:125
uint16 nodeI
Definition: spgxlog.h:128
OffsetNumber offnumPrefix
Definition: spgxlog.h:144
bool newPage
Definition: spgxlog.h:112
OffsetNumber offnumHeadLeaf
Definition: spgxlog.h:51
bool storesNulls
Definition: spgxlog.h:49
uint16 nodeI
Definition: spgxlog.h:54
bool postfixBlkSame
Definition: spgxlog.h:149
OffsetNumber offnumParent
Definition: spgxlog.h:126
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
uint16 nPlaceholder
Definition: spgxlog.h:204
#define XLOG_SPGIST_VACUUM_LEAF
Definition: spgxlog.h:27
OffsetNumber offnumParent
Definition: spgxlog.h:72
bool storesNulls
Definition: spgxlog.h:69
bool storesNulls
Definition: spgxlog.h:178
uint16 nMoves
Definition: spgxlog.h:66
bool isRootSplit
Definition: spgxlog.h:167

◆ spg_identify()

const char* spg_identify ( uint8  info)

Definition at line 131 of file spgdesc.c.

References XLOG_SPGIST_ADD_LEAF, XLOG_SPGIST_ADD_NODE, XLOG_SPGIST_MOVE_LEAFS, XLOG_SPGIST_PICKSPLIT, XLOG_SPGIST_SPLIT_TUPLE, XLOG_SPGIST_VACUUM_LEAF, XLOG_SPGIST_VACUUM_REDIRECT, XLOG_SPGIST_VACUUM_ROOT, and XLR_INFO_MASK.

132 {
133  const char *id = NULL;
134 
135  switch (info & ~XLR_INFO_MASK)
136  {
138  id = "ADD_LEAF";
139  break;
141  id = "MOVE_LEAFS";
142  break;
144  id = "ADD_NODE";
145  break;
147  id = "SPLIT_TUPLE";
148  break;
150  id = "PICKSPLIT";
151  break;
153  id = "VACUUM_LEAF";
154  break;
156  id = "VACUUM_ROOT";
157  break;
159  id = "VACUUM_REDIRECT";
160  break;
161  }
162 
163  return id;
164 }
#define XLOG_SPGIST_MOVE_LEAFS
Definition: spgxlog.h:23
#define XLOG_SPGIST_VACUUM_REDIRECT
Definition: spgxlog.h:29
#define XLOG_SPGIST_SPLIT_TUPLE
Definition: spgxlog.h:25
#define XLOG_SPGIST_ADD_NODE
Definition: spgxlog.h:24
#define XLOG_SPGIST_ADD_LEAF
Definition: spgxlog.h:22
#define XLOG_SPGIST_PICKSPLIT
Definition: spgxlog.h:26
#define XLOG_SPGIST_VACUUM_ROOT
Definition: spgxlog.h:28
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_SPGIST_VACUUM_LEAF
Definition: spgxlog.h:27