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.

21 {
22  char *rec = XLogRecGetData(record);
23  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
24 
25  switch (info)
26  {
31  {
32  xl_btree_insert *xlrec = (xl_btree_insert *) rec;
33 
34  appendStringInfo(buf, "off %u", xlrec->offnum);
35  break;
36  }
37  case XLOG_BTREE_SPLIT_L:
38  case XLOG_BTREE_SPLIT_R:
39  {
40  xl_btree_split *xlrec = (xl_btree_split *) rec;
41 
42  appendStringInfo(buf, "level %u, firstrightoff %d, newitemoff %d, postingoff %d",
43  xlrec->level, xlrec->firstrightoff,
44  xlrec->newitemoff, xlrec->postingoff);
45  break;
46  }
47  case XLOG_BTREE_DEDUP:
48  {
49  xl_btree_dedup *xlrec = (xl_btree_dedup *) rec;
50 
51  appendStringInfo(buf, "nintervals %u", xlrec->nintervals);
52  break;
53  }
54  case XLOG_BTREE_VACUUM:
55  {
56  xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
57 
58  appendStringInfo(buf, "ndeleted %u; nupdated %u",
59  xlrec->ndeleted, xlrec->nupdated);
60  break;
61  }
62  case XLOG_BTREE_DELETE:
63  {
64  xl_btree_delete *xlrec = (xl_btree_delete *) rec;
65 
66  appendStringInfo(buf, "snapshotConflictHorizon %u; ndeleted %u; nupdated %u",
68  xlrec->ndeleted, xlrec->nupdated);
69  break;
70  }
72  {
74 
75  appendStringInfo(buf, "topparent %u; leaf %u; left %u; right %u",
76  xlrec->topparent, xlrec->leafblk, xlrec->leftblk, xlrec->rightblk);
77  break;
78  }
81  {
83 
84  appendStringInfo(buf, "left %u; right %u; level %u; safexid %u:%u; ",
85  xlrec->leftsib, xlrec->rightsib, xlrec->level,
88  appendStringInfo(buf, "leafleft %u; leafright %u; leaftopparent %u",
89  xlrec->leafleftsib, xlrec->leafrightsib,
90  xlrec->leaftopparent);
91  break;
92  }
93  case XLOG_BTREE_NEWROOT:
94  {
95  xl_btree_newroot *xlrec = (xl_btree_newroot *) rec;
96 
97  appendStringInfo(buf, "lev %u", xlrec->level);
98  break;
99  }
101  {
102  xl_btree_reuse_page *xlrec = (xl_btree_reuse_page *) rec;
103 
104  appendStringInfo(buf, "rel %u/%u/%u; snapshotConflictHorizon %u:%u",
105  xlrec->locator.spcOid, xlrec->locator.dbOid,
106  xlrec->locator.relNumber,
109  break;
110  }
112  {
113  xl_btree_metadata *xlrec;
114 
115  xlrec = (xl_btree_metadata *) XLogRecGetBlockData(record, 0,
116  NULL);
117  appendStringInfo(buf, "last_cleanup_num_delpages %u",
119  break;
120  }
121  }
122 }
unsigned char uint8
Definition: c.h:488
#define XLOG_BTREE_META_CLEANUP
Definition: nbtxlog.h:41
#define XLOG_BTREE_INSERT_POST
Definition: nbtxlog.h:32
#define XLOG_BTREE_VACUUM
Definition: nbtxlog.h:39
#define XLOG_BTREE_SPLIT_R
Definition: nbtxlog.h:31
#define XLOG_BTREE_INSERT_LEAF
Definition: nbtxlog.h:27
#define XLOG_BTREE_INSERT_UPPER
Definition: nbtxlog.h:28
#define XLOG_BTREE_DEDUP
Definition: nbtxlog.h:33
#define XLOG_BTREE_UNLINK_PAGE
Definition: nbtxlog.h:35
#define XLOG_BTREE_UNLINK_PAGE_META
Definition: nbtxlog.h:36
#define XLOG_BTREE_INSERT_META
Definition: nbtxlog.h:29
#define XLOG_BTREE_MARK_PAGE_HALFDEAD
Definition: nbtxlog.h:38
#define XLOG_BTREE_REUSE_PAGE
Definition: nbtxlog.h:40
#define XLOG_BTREE_SPLIT_L
Definition: nbtxlog.h:30
#define XLOG_BTREE_NEWROOT
Definition: nbtxlog.h:37
#define XLOG_BTREE_DELETE
Definition: nbtxlog.h:34
static char * buf
Definition: pg_test_fsync.c:67
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:91
RelFileNumber relNumber
uint16 nintervals
Definition: nbtxlog.h:169
TransactionId snapshotConflictHorizon
Definition: nbtxlog.h:232
uint16 ndeleted
Definition: nbtxlog.h:233
uint16 nupdated
Definition: nbtxlog.h:234
OffsetNumber offnum
Definition: nbtxlog.h:78
uint32 last_cleanup_num_delpages
Definition: nbtxlog.h:53
uint32 level
Definition: nbtxlog.h:332
FullTransactionId snapshotConflictHorizon
Definition: nbtxlog.h:187
RelFileLocator locator
Definition: nbtxlog.h:185
uint16 postingoff
Definition: nbtxlog.h:155
OffsetNumber firstrightoff
Definition: nbtxlog.h:153
uint32 level
Definition: nbtxlog.h:152
OffsetNumber newitemoff
Definition: nbtxlog.h:154
uint16 ndeleted
Definition: nbtxlog.h:220
uint16 nupdated
Definition: nbtxlog.h:221
#define EpochFromFullTransactionId(x)
Definition: transam.h:47
#define XidFromFullTransactionId(x)
Definition: transam.h:48
char * XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len)
Definition: xlogreader.c:2014
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:409
#define XLogRecGetData(decoder)
Definition: xlogreader.h:414
#define XLR_INFO_MASK
Definition: xlogrecord.h:62

References appendStringInfo(), buf, RelFileLocator::dbOid, EpochFromFullTransactionId, xl_btree_split::firstrightoff, xl_btree_metadata::last_cleanup_num_delpages, xl_btree_mark_page_halfdead::leafblk, xl_btree_unlink_page::leafleftsib, xl_btree_unlink_page::leafrightsib, xl_btree_unlink_page::leaftopparent, xl_btree_mark_page_halfdead::leftblk, xl_btree_unlink_page::leftsib, xl_btree_split::level, xl_btree_unlink_page::level, xl_btree_newroot::level, xl_btree_reuse_page::locator, xl_btree_vacuum::ndeleted, xl_btree_delete::ndeleted, xl_btree_split::newitemoff, xl_btree_dedup::nintervals, xl_btree_vacuum::nupdated, xl_btree_delete::nupdated, xl_btree_insert::offnum, xl_btree_split::postingoff, RelFileLocator::relNumber, xl_btree_mark_page_halfdead::rightblk, xl_btree_unlink_page::rightsib, xl_btree_unlink_page::safexid, xl_btree_reuse_page::snapshotConflictHorizon, xl_btree_delete::snapshotConflictHorizon, RelFileLocator::spcOid, xl_btree_mark_page_halfdead::topparent, XidFromFullTransactionId, XLOG_BTREE_DEDUP, XLOG_BTREE_DELETE, XLOG_BTREE_INSERT_LEAF, XLOG_BTREE_INSERT_META, XLOG_BTREE_INSERT_POST, 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_R, XLOG_BTREE_UNLINK_PAGE, XLOG_BTREE_UNLINK_PAGE_META, XLOG_BTREE_VACUUM, XLogRecGetBlockData(), XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

◆ btree_identify()

const char* btree_identify ( uint8  info)

Definition at line 125 of file nbtdesc.c.

126 {
127  const char *id = NULL;
128 
129  switch (info & ~XLR_INFO_MASK)
130  {
132  id = "INSERT_LEAF";
133  break;
135  id = "INSERT_UPPER";
136  break;
138  id = "INSERT_META";
139  break;
140  case XLOG_BTREE_SPLIT_L:
141  id = "SPLIT_L";
142  break;
143  case XLOG_BTREE_SPLIT_R:
144  id = "SPLIT_R";
145  break;
147  id = "INSERT_POST";
148  break;
149  case XLOG_BTREE_DEDUP:
150  id = "DEDUP";
151  break;
152  case XLOG_BTREE_VACUUM:
153  id = "VACUUM";
154  break;
155  case XLOG_BTREE_DELETE:
156  id = "DELETE";
157  break;
159  id = "MARK_PAGE_HALFDEAD";
160  break;
162  id = "UNLINK_PAGE";
163  break;
165  id = "UNLINK_PAGE_META";
166  break;
167  case XLOG_BTREE_NEWROOT:
168  id = "NEWROOT";
169  break;
171  id = "REUSE_PAGE";
172  break;
174  id = "META_CLEANUP";
175  break;
176  }
177 
178  return id;
179 }

References XLOG_BTREE_DEDUP, XLOG_BTREE_DELETE, XLOG_BTREE_INSERT_LEAF, XLOG_BTREE_INSERT_META, XLOG_BTREE_INSERT_POST, 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_R, XLOG_BTREE_UNLINK_PAGE, XLOG_BTREE_UNLINK_PAGE_META, XLOG_BTREE_VACUUM, and XLR_INFO_MASK.