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

Go to the source code of this file.

Functions

void btree_desc (StringInfo buf, XLogReaderState *record)
 
const char * btree_identify (uint8 info)
 

Function Documentation

◆ btree_desc()

void btree_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 20 of file nbtdesc.c.

References appendStringInfo(), xl_btree_unlink_page::btpo_xact, RelFileNode::dbNode, xl_btree_split::firstright, xl_btree_vacuum::lastBlockVacuumed, xl_btree_reuse_page::latestRemovedXid, xl_btree_mark_page_halfdead::leafblk, xl_btree_unlink_page::leafleftsib, xl_btree_unlink_page::leafrightsib, xl_btree_mark_page_halfdead::leftblk, xl_btree_unlink_page::leftsib, xl_btree_split::level, xl_btree_newroot::level, xl_btree_delete::nitems, xl_btree_reuse_page::node, xl_btree_insert::offnum, RelFileNode::relNode, xl_btree_mark_page_halfdead::rightblk, xl_btree_unlink_page::rightsib, RelFileNode::spcNode, xl_btree_mark_page_halfdead::topparent, xl_btree_unlink_page::topparent, XLOG_BTREE_DELETE, XLOG_BTREE_INSERT_LEAF, XLOG_BTREE_INSERT_META, XLOG_BTREE_INSERT_UPPER, XLOG_BTREE_MARK_PAGE_HALFDEAD, XLOG_BTREE_NEWROOT, XLOG_BTREE_REUSE_PAGE, XLOG_BTREE_SPLIT_L, XLOG_BTREE_SPLIT_R, XLOG_BTREE_UNLINK_PAGE, XLOG_BTREE_UNLINK_PAGE_META, XLOG_BTREE_VACUUM, 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  {
30  {
31  xl_btree_insert *xlrec = (xl_btree_insert *) rec;
32 
33  appendStringInfo(buf, "off %u", xlrec->offnum);
34  break;
35  }
36  case XLOG_BTREE_SPLIT_L:
37  case XLOG_BTREE_SPLIT_R:
38  {
39  xl_btree_split *xlrec = (xl_btree_split *) rec;
40 
41  appendStringInfo(buf, "level %u, firstright %d",
42  xlrec->level, xlrec->firstright);
43  break;
44  }
45  case XLOG_BTREE_VACUUM:
46  {
47  xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
48 
49  appendStringInfo(buf, "lastBlockVacuumed %u",
50  xlrec->lastBlockVacuumed);
51  break;
52  }
53  case XLOG_BTREE_DELETE:
54  {
55  xl_btree_delete *xlrec = (xl_btree_delete *) rec;
56 
57  appendStringInfo(buf, "%d items", xlrec->nitems);
58  break;
59  }
61  {
63 
64  appendStringInfo(buf, "topparent %u; leaf %u; left %u; right %u",
65  xlrec->topparent, xlrec->leafblk, xlrec->leftblk, xlrec->rightblk);
66  break;
67  }
70  {
72 
73  appendStringInfo(buf, "left %u; right %u; btpo_xact %u; ",
74  xlrec->leftsib, xlrec->rightsib,
75  xlrec->btpo_xact);
76  appendStringInfo(buf, "leafleft %u; leafright %u; topparent %u",
77  xlrec->leafleftsib, xlrec->leafrightsib,
78  xlrec->topparent);
79  break;
80  }
81  case XLOG_BTREE_NEWROOT:
82  {
83  xl_btree_newroot *xlrec = (xl_btree_newroot *) rec;
84 
85  appendStringInfo(buf, "lev %u", xlrec->level);
86  break;
87  }
89  {
91 
92  appendStringInfo(buf, "rel %u/%u/%u; latestRemovedXid %u",
93  xlrec->node.spcNode, xlrec->node.dbNode,
94  xlrec->node.relNode, xlrec->latestRemovedXid);
95  break;
96  }
97  }
98 }
BlockNumber lastBlockVacuumed
Definition: nbtxlog.h:166
unsigned char uint8
Definition: c.h:294
#define XLOG_BTREE_INSERT_META
Definition: nbtxlog.h:28
RelFileNode node
Definition: nbtxlog.h:134
uint32 level
Definition: nbtxlog.h:240
#define XLOG_BTREE_NEWROOT
Definition: nbtxlog.h:35
#define XLogRecGetData(decoder)
Definition: xlogreader.h:226
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
#define XLOG_BTREE_INSERT_LEAF
Definition: nbtxlog.h:26
#define XLOG_BTREE_VACUUM
Definition: nbtxlog.h:37
#define XLOG_BTREE_UNLINK_PAGE
Definition: nbtxlog.h:33
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:222
#define XLOG_BTREE_DELETE
Definition: nbtxlog.h:32
#define XLOG_BTREE_REUSE_PAGE
Definition: nbtxlog.h:39
uint32 level
Definition: nbtxlog.h:104
#define XLOG_BTREE_MARK_PAGE_HALFDEAD
Definition: nbtxlog.h:36
OffsetNumber offnum
Definition: nbtxlog.h:65
#define XLOG_BTREE_SPLIT_R
Definition: nbtxlog.h:30
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
OffsetNumber firstright
Definition: nbtxlog.h:105
#define XLOG_BTREE_INSERT_UPPER
Definition: nbtxlog.h:27
#define XLOG_BTREE_SPLIT_L
Definition: nbtxlog.h:29
#define XLOG_BTREE_UNLINK_PAGE_META
Definition: nbtxlog.h:34
TransactionId latestRemovedXid
Definition: nbtxlog.h:136

◆ btree_identify()

const char* btree_identify ( uint8  info)

Definition at line 101 of file nbtdesc.c.

References XLOG_BTREE_DELETE, XLOG_BTREE_INSERT_LEAF, XLOG_BTREE_INSERT_META, XLOG_BTREE_INSERT_UPPER, XLOG_BTREE_MARK_PAGE_HALFDEAD, XLOG_BTREE_NEWROOT, XLOG_BTREE_REUSE_PAGE, XLOG_BTREE_SPLIT_L, XLOG_BTREE_SPLIT_R, XLOG_BTREE_UNLINK_PAGE, XLOG_BTREE_UNLINK_PAGE_META, XLOG_BTREE_VACUUM, and XLR_INFO_MASK.

102 {
103  const char *id = NULL;
104 
105  switch (info & ~XLR_INFO_MASK)
106  {
108  id = "INSERT_LEAF";
109  break;
111  id = "INSERT_UPPER";
112  break;
114  id = "INSERT_META";
115  break;
116  case XLOG_BTREE_SPLIT_L:
117  id = "SPLIT_L";
118  break;
119  case XLOG_BTREE_SPLIT_R:
120  id = "SPLIT_R";
121  break;
122  case XLOG_BTREE_VACUUM:
123  id = "VACUUM";
124  break;
125  case XLOG_BTREE_DELETE:
126  id = "DELETE";
127  break;
129  id = "MARK_PAGE_HALFDEAD";
130  break;
132  id = "UNLINK_PAGE";
133  break;
135  id = "UNLINK_PAGE_META";
136  break;
137  case XLOG_BTREE_NEWROOT:
138  id = "NEWROOT";
139  break;
141  id = "REUSE_PAGE";
142  break;
143  }
144 
145  return id;
146 }
#define XLOG_BTREE_INSERT_META
Definition: nbtxlog.h:28
#define XLOG_BTREE_NEWROOT
Definition: nbtxlog.h:35
#define XLOG_BTREE_INSERT_LEAF
Definition: nbtxlog.h:26
#define XLOG_BTREE_VACUUM
Definition: nbtxlog.h:37
#define XLOG_BTREE_UNLINK_PAGE
Definition: nbtxlog.h:33
#define XLOG_BTREE_DELETE
Definition: nbtxlog.h:32
#define XLOG_BTREE_REUSE_PAGE
Definition: nbtxlog.h:39
#define XLOG_BTREE_MARK_PAGE_HALFDEAD
Definition: nbtxlog.h:36
#define XLOG_BTREE_SPLIT_R
Definition: nbtxlog.h:30
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_BTREE_INSERT_UPPER
Definition: nbtxlog.h:27
#define XLOG_BTREE_SPLIT_L
Definition: nbtxlog.h:29
#define XLOG_BTREE_UNLINK_PAGE_META
Definition: nbtxlog.h:34