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(), spgxlogPickSplit::innerIsParent, spgxlogPickSplit::isRootSplit, spgxlogPickSplit::nDelete, spgxlogAddLeaf::newPage, spgxlogPickSplit::nInsert, spgxlogAddLeaf::offnumHeadLeaf, spgxlogAddLeaf::offnumLeaf, spgxlogAddLeaf::offnumParent, spgxlogAddLeaf::storesNulls, XLOG_SPGIST_ADD_LEAF, XLOG_SPGIST_ADD_NODE, XLOG_SPGIST_CREATE_INDEX, 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  break;
30  {
31  spgxlogAddLeaf *xlrec = (spgxlogAddLeaf *) rec;
32 
33  appendStringInfoString(buf, "add leaf to page");
34  appendStringInfo(buf, "; off %u; headoff %u; parentoff %u",
35  xlrec->offnumLeaf, xlrec->offnumHeadLeaf,
36  xlrec->offnumParent);
37  if (xlrec->newPage)
38  appendStringInfoString(buf, " (newpage)");
39  if (xlrec->storesNulls)
40  appendStringInfoString(buf, " (nulls)");
41  }
42  break;
44  appendStringInfo(buf, "%u leafs",
45  ((spgxlogMoveLeafs *) rec)->nMoves);
46  break;
48  appendStringInfo(buf, "off %u",
49  ((spgxlogAddNode *) rec)->offnum);
50  break;
52  appendStringInfo(buf, "prefix off: %u, postfix off: %u (same %d, new %d)",
53  ((spgxlogSplitTuple *) rec)->offnumPrefix,
54  ((spgxlogSplitTuple *) rec)->offnumPostfix,
55  ((spgxlogSplitTuple *) rec)->postfixBlkSame,
56  ((spgxlogSplitTuple *) rec)->newPage
57  );
58  break;
60  {
61  spgxlogPickSplit *xlrec = (spgxlogPickSplit *) rec;
62 
63  appendStringInfo(buf, "ndel %u; nins %u",
64  xlrec->nDelete, xlrec->nInsert);
65  if (xlrec->innerIsParent)
66  appendStringInfoString(buf, " (innerIsParent)");
67  if (xlrec->isRootSplit)
68  appendStringInfoString(buf, " (isRootSplit)");
69  }
70  break;
72  /* no further information */
73  break;
75  /* no further information */
76  break;
78  appendStringInfo(buf, "newest XID %u",
79  ((spgxlogVacuumRedirect *) rec)->newestRedirectXid);
80  break;
81  }
82 }
#define XLOG_SPGIST_MOVE_LEAFS
Definition: spgxlog.h:23
#define XLOG_SPGIST_VACUUM_REDIRECT
Definition: spgxlog.h:29
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
unsigned char uint8
Definition: c.h:304
#define XLOG_SPGIST_ADD_NODE
Definition: spgxlog.h:24
#define XLOG_SPGIST_ADD_LEAF
Definition: spgxlog.h:22
uint16 nInsert
Definition: spgxlog.h:170
bool innerIsParent
Definition: spgxlog.h:181
#define XLOG_SPGIST_PICKSPLIT
Definition: spgxlog.h:26
#define XLOG_SPGIST_VACUUM_ROOT
Definition: spgxlog.h:28
#define XLogRecGetData(decoder)
Definition: xlogreader.h:226
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
#define XLOG_SPGIST_CREATE_INDEX
Definition: spgxlog.h:21
bool newPage
Definition: spgxlog.h:48
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:157
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:222
OffsetNumber offnumHeadLeaf
Definition: spgxlog.h:51
bool storesNulls
Definition: spgxlog.h:49
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_SPGIST_VACUUM_LEAF
Definition: spgxlog.h:27
bool isRootSplit
Definition: spgxlog.h:167

◆ spg_identify()

const char* spg_identify ( uint8  info)

Definition at line 85 of file spgdesc.c.

References XLOG_SPGIST_ADD_LEAF, XLOG_SPGIST_ADD_NODE, XLOG_SPGIST_CREATE_INDEX, 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.

86 {
87  const char *id = NULL;
88 
89  switch (info & ~XLR_INFO_MASK)
90  {
92  id = "CREATE_INDEX";
93  break;
95  id = "ADD_LEAF";
96  break;
98  id = "MOVE_LEAFS";
99  break;
101  id = "ADD_NODE";
102  break;
104  id = "SPLIT_TUPLE";
105  break;
107  id = "PICKSPLIT";
108  break;
110  id = "VACUUM_LEAF";
111  break;
113  id = "VACUUM_ROOT";
114  break;
116  id = "VACUUM_REDIRECT";
117  break;
118  }
119 
120  return id;
121 }
#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 XLOG_SPGIST_CREATE_INDEX
Definition: spgxlog.h:21
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_SPGIST_VACUUM_LEAF
Definition: spgxlog.h:27