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_metadata::last_cleanup_num_heap_tuples, 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, xl_btree_metadata::oldest_btpo_xact, 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_META_CLEANUP, XLOG_BTREE_NEWROOT, XLOG_BTREE_REUSE_PAGE, XLOG_BTREE_SPLIT_L, XLOG_BTREE_SPLIT_L_HIGHKEY, XLOG_BTREE_SPLIT_R, XLOG_BTREE_SPLIT_R_HIGHKEY, 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:
40  {
41  xl_btree_split *xlrec = (xl_btree_split *) rec;
42 
43  appendStringInfo(buf, "level %u, firstright %d",
44  xlrec->level, xlrec->firstright);
45  break;
46  }
47  case XLOG_BTREE_VACUUM:
48  {
49  xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
50 
51  appendStringInfo(buf, "lastBlockVacuumed %u",
52  xlrec->lastBlockVacuumed);
53  break;
54  }
55  case XLOG_BTREE_DELETE:
56  {
57  xl_btree_delete *xlrec = (xl_btree_delete *) rec;
58 
59  appendStringInfo(buf, "%d items", xlrec->nitems);
60  break;
61  }
63  {
65 
66  appendStringInfo(buf, "topparent %u; leaf %u; left %u; right %u",
67  xlrec->topparent, xlrec->leafblk, xlrec->leftblk, xlrec->rightblk);
68  break;
69  }
72  {
74 
75  appendStringInfo(buf, "left %u; right %u; btpo_xact %u; ",
76  xlrec->leftsib, xlrec->rightsib,
77  xlrec->btpo_xact);
78  appendStringInfo(buf, "leafleft %u; leafright %u; topparent %u",
79  xlrec->leafleftsib, xlrec->leafrightsib,
80  xlrec->topparent);
81  break;
82  }
83  case XLOG_BTREE_NEWROOT:
84  {
85  xl_btree_newroot *xlrec = (xl_btree_newroot *) rec;
86 
87  appendStringInfo(buf, "lev %u", xlrec->level);
88  break;
89  }
91  {
93 
94  appendStringInfo(buf, "rel %u/%u/%u; latestRemovedXid %u",
95  xlrec->node.spcNode, xlrec->node.dbNode,
96  xlrec->node.relNode, xlrec->latestRemovedXid);
97  break;
98  }
100  {
101  xl_btree_metadata *xlrec = (xl_btree_metadata *) rec;
102 
103  appendStringInfo(buf, "oldest_btpo_xact %u; last_cleanup_num_heap_tuples: %f",
104  xlrec->oldest_btpo_xact,
106  break;
107  }
108  }
109 }
BlockNumber lastBlockVacuumed
Definition: nbtxlog.h:172
unsigned char uint8
Definition: c.h:323
#define XLOG_BTREE_INSERT_META
Definition: nbtxlog.h:28
RelFileNode node
Definition: nbtxlog.h:140
uint32 level
Definition: nbtxlog.h:246
#define XLOG_BTREE_NEWROOT
Definition: nbtxlog.h:36
#define XLogRecGetData(decoder)
Definition: xlogreader.h:230
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
float8 last_cleanup_num_heap_tuples
Definition: nbtxlog.h:55
#define XLOG_BTREE_INSERT_LEAF
Definition: nbtxlog.h:26
TransactionId oldest_btpo_xact
Definition: nbtxlog.h:54
#define XLOG_BTREE_SPLIT_L_HIGHKEY
Definition: nbtxlog.h:31
#define XLOG_BTREE_VACUUM
Definition: nbtxlog.h:38
#define XLOG_BTREE_UNLINK_PAGE
Definition: nbtxlog.h:34
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:226
#define XLOG_BTREE_DELETE
Definition: nbtxlog.h:33
#define XLOG_BTREE_REUSE_PAGE
Definition: nbtxlog.h:40
uint32 level
Definition: nbtxlog.h:110
#define XLOG_BTREE_MARK_PAGE_HALFDEAD
Definition: nbtxlog.h:37
OffsetNumber offnum
Definition: nbtxlog.h:70
#define XLOG_BTREE_SPLIT_R
Definition: nbtxlog.h:30
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
OffsetNumber firstright
Definition: nbtxlog.h:111
#define XLOG_BTREE_SPLIT_R_HIGHKEY
Definition: nbtxlog.h:32
#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:35
TransactionId latestRemovedXid
Definition: nbtxlog.h:142
#define XLOG_BTREE_META_CLEANUP
Definition: nbtxlog.h:42

◆ btree_identify()

const char* btree_identify ( uint8  info)

Definition at line 112 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_META_CLEANUP, XLOG_BTREE_NEWROOT, XLOG_BTREE_REUSE_PAGE, XLOG_BTREE_SPLIT_L, XLOG_BTREE_SPLIT_L_HIGHKEY, XLOG_BTREE_SPLIT_R, XLOG_BTREE_SPLIT_R_HIGHKEY, XLOG_BTREE_UNLINK_PAGE, XLOG_BTREE_UNLINK_PAGE_META, XLOG_BTREE_VACUUM, and XLR_INFO_MASK.

113 {
114  const char *id = NULL;
115 
116  switch (info & ~XLR_INFO_MASK)
117  {
119  id = "INSERT_LEAF";
120  break;
122  id = "INSERT_UPPER";
123  break;
125  id = "INSERT_META";
126  break;
127  case XLOG_BTREE_SPLIT_L:
128  id = "SPLIT_L";
129  break;
130  case XLOG_BTREE_SPLIT_R:
131  id = "SPLIT_R";
132  break;
134  id = "SPLIT_L_HIGHKEY";
135  break;
137  id = "SPLIT_R_HIGHKEY";
138  break;
139  case XLOG_BTREE_VACUUM:
140  id = "VACUUM";
141  break;
142  case XLOG_BTREE_DELETE:
143  id = "DELETE";
144  break;
146  id = "MARK_PAGE_HALFDEAD";
147  break;
149  id = "UNLINK_PAGE";
150  break;
152  id = "UNLINK_PAGE_META";
153  break;
154  case XLOG_BTREE_NEWROOT:
155  id = "NEWROOT";
156  break;
158  id = "REUSE_PAGE";
159  break;
161  id = "META_CLEANUP";
162  break;
163  }
164 
165  return id;
166 }
#define XLOG_BTREE_INSERT_META
Definition: nbtxlog.h:28
#define XLOG_BTREE_NEWROOT
Definition: nbtxlog.h:36
#define XLOG_BTREE_INSERT_LEAF
Definition: nbtxlog.h:26
#define XLOG_BTREE_SPLIT_L_HIGHKEY
Definition: nbtxlog.h:31
#define XLOG_BTREE_VACUUM
Definition: nbtxlog.h:38
#define XLOG_BTREE_UNLINK_PAGE
Definition: nbtxlog.h:34
#define XLOG_BTREE_DELETE
Definition: nbtxlog.h:33
#define XLOG_BTREE_REUSE_PAGE
Definition: nbtxlog.h:40
#define XLOG_BTREE_MARK_PAGE_HALFDEAD
Definition: nbtxlog.h:37
#define XLOG_BTREE_SPLIT_R
Definition: nbtxlog.h:30
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_BTREE_SPLIT_R_HIGHKEY
Definition: nbtxlog.h:32
#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:35
#define XLOG_BTREE_META_CLEANUP
Definition: nbtxlog.h:42