PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
heapdesc.c File Reference
#include "postgres.h"
#include "access/heapam_xlog.h"
Include dependency graph for heapdesc.c:

Go to the source code of this file.

Functions

static void out_infobits (StringInfo buf, uint8 infobits)
 
void heap_desc (StringInfo buf, XLogReaderState *record)
 
void heap2_desc (StringInfo buf, XLogReaderState *record)
 
const char * heap_identify (uint8 info)
 
const char * heap2_identify (uint8 info)
 

Function Documentation

void heap2_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 100 of file heapdesc.c.

References appendStringInfo(), xl_heap_new_cid::cmax, xl_heap_new_cid::cmin, xl_heap_new_cid::combocid, xl_heap_freeze_page::cutoff_xid, xl_heap_visible::cutoff_xid, RelFileNode::dbNode, xl_heap_lock_updated::flags, xl_heap_visible::flags, xl_heap_lock_updated::infobits_set, ItemPointerGetBlockNumber, ItemPointerGetOffsetNumber, xl_heap_clean::latestRemovedXid, xl_heap_cleanup_info::latestRemovedXid, xl_heap_multi_insert::ntuples, xl_heap_freeze_page::ntuples, xl_heap_lock_updated::offnum, out_infobits(), RelFileNode::relNode, RelFileNode::spcNode, xl_heap_new_cid::target_node, xl_heap_new_cid::target_tid, XLOG_HEAP2_CLEAN, XLOG_HEAP2_CLEANUP_INFO, XLOG_HEAP2_FREEZE_PAGE, XLOG_HEAP2_LOCK_UPDATED, XLOG_HEAP2_MULTI_INSERT, XLOG_HEAP2_NEW_CID, XLOG_HEAP2_VISIBLE, XLOG_HEAP_OPMASK, XLogRecGetData, XLogRecGetInfo, XLR_INFO_MASK, and xl_heap_lock_updated::xmax.

101 {
102  char *rec = XLogRecGetData(record);
103  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
104 
105  info &= XLOG_HEAP_OPMASK;
106  if (info == XLOG_HEAP2_CLEAN)
107  {
108  xl_heap_clean *xlrec = (xl_heap_clean *) rec;
109 
110  appendStringInfo(buf, "remxid %u", xlrec->latestRemovedXid);
111  }
112  else if (info == XLOG_HEAP2_FREEZE_PAGE)
113  {
114  xl_heap_freeze_page *xlrec = (xl_heap_freeze_page *) rec;
115 
116  appendStringInfo(buf, "cutoff xid %u ntuples %u",
117  xlrec->cutoff_xid, xlrec->ntuples);
118  }
119  else if (info == XLOG_HEAP2_CLEANUP_INFO)
120  {
122 
123  appendStringInfo(buf, "remxid %u", xlrec->latestRemovedXid);
124  }
125  else if (info == XLOG_HEAP2_VISIBLE)
126  {
127  xl_heap_visible *xlrec = (xl_heap_visible *) rec;
128 
129  appendStringInfo(buf, "cutoff xid %u flags %d",
130  xlrec->cutoff_xid, xlrec->flags);
131  }
132  else if (info == XLOG_HEAP2_MULTI_INSERT)
133  {
135 
136  appendStringInfo(buf, "%d tuples", xlrec->ntuples);
137  }
138  else if (info == XLOG_HEAP2_LOCK_UPDATED)
139  {
141 
142  appendStringInfo(buf, "off %u: xmax %u: flags %u ",
143  xlrec->offnum, xlrec->xmax, xlrec->flags);
144  out_infobits(buf, xlrec->infobits_set);
145  }
146  else if (info == XLOG_HEAP2_NEW_CID)
147  {
148  xl_heap_new_cid *xlrec = (xl_heap_new_cid *) rec;
149 
150  appendStringInfo(buf, "rel %u/%u/%u; tid %u/%u",
151  xlrec->target_node.spcNode,
152  xlrec->target_node.dbNode,
153  xlrec->target_node.relNode,
156  appendStringInfo(buf, "; cmin: %u, cmax: %u, combo: %u",
157  xlrec->cmin, xlrec->cmax, xlrec->combocid);
158  }
159 }
#define XLOG_HEAP2_LOCK_UPDATED
Definition: heapam_xlog.h:59
CommandId combocid
Definition: heapam_xlog.h:348
TransactionId cutoff_xid
Definition: heapam_xlog.h:313
unsigned char uint8
Definition: c.h:266
#define XLOG_HEAP_OPMASK
Definition: heapam_xlog.h:41
CommandId cmax
Definition: heapam_xlog.h:341
ItemPointerData target_tid
Definition: heapam_xlog.h:354
OffsetNumber offnum
Definition: heapam_xlog.h:264
#define XLOG_HEAP2_MULTI_INSERT
Definition: heapam_xlog.h:58
#define XLOG_HEAP2_VISIBLE
Definition: heapam_xlog.h:57
#define XLogRecGetData(decoder)
Definition: xlogreader.h:218
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:110
TransactionId cutoff_xid
Definition: heapam_xlog.h:327
#define XLOG_HEAP2_CLEAN
Definition: heapam_xlog.h:54
#define XLOG_HEAP2_CLEANUP_INFO
Definition: heapam_xlog.h:56
static void out_infobits(StringInfo buf, uint8 infobits)
Definition: heapdesc.c:20
#define XLOG_HEAP2_NEW_CID
Definition: heapam_xlog.h:60
TransactionId xmax
Definition: heapam_xlog.h:263
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:214
RelFileNode target_node
Definition: heapam_xlog.h:353
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define ItemPointerGetOffsetNumber(pointer)
Definition: itemptr.h:94
#define XLOG_HEAP2_FREEZE_PAGE
Definition: heapam_xlog.h:55
TransactionId latestRemovedXid
Definition: heapam_xlog.h:218
CommandId cmin
Definition: heapam_xlog.h:340
#define ItemPointerGetBlockNumber(pointer)
Definition: itemptr.h:75
TransactionId latestRemovedXid
Definition: heapam_xlog.h:234
const char* heap2_identify ( uint8  info)

Definition at line 204 of file heapdesc.c.

References NULL, XLOG_HEAP2_CLEAN, XLOG_HEAP2_CLEANUP_INFO, XLOG_HEAP2_FREEZE_PAGE, XLOG_HEAP2_LOCK_UPDATED, XLOG_HEAP2_MULTI_INSERT, XLOG_HEAP2_NEW_CID, XLOG_HEAP2_REWRITE, XLOG_HEAP2_VISIBLE, XLOG_HEAP_INIT_PAGE, and XLR_INFO_MASK.

205 {
206  const char *id = NULL;
207 
208  switch (info & ~XLR_INFO_MASK)
209  {
210  case XLOG_HEAP2_CLEAN:
211  id = "CLEAN";
212  break;
214  id = "FREEZE_PAGE";
215  break;
217  id = "CLEANUP_INFO";
218  break;
219  case XLOG_HEAP2_VISIBLE:
220  id = "VISIBLE";
221  break;
223  id = "MULTI_INSERT";
224  break;
226  id = "MULTI_INSERT+INIT";
227  break;
229  id = "LOCK_UPDATED";
230  break;
231  case XLOG_HEAP2_NEW_CID:
232  id = "NEW_CID";
233  break;
234  case XLOG_HEAP2_REWRITE:
235  id = "REWRITE";
236  break;
237  }
238 
239  return id;
240 }
#define XLOG_HEAP2_LOCK_UPDATED
Definition: heapam_xlog.h:59
#define XLOG_HEAP2_REWRITE
Definition: heapam_xlog.h:53
#define XLOG_HEAP_INIT_PAGE
Definition: heapam_xlog.h:46
#define XLOG_HEAP2_MULTI_INSERT
Definition: heapam_xlog.h:58
#define XLOG_HEAP2_VISIBLE
Definition: heapam_xlog.h:57
#define XLOG_HEAP2_CLEAN
Definition: heapam_xlog.h:54
#define XLOG_HEAP2_CLEANUP_INFO
Definition: heapam_xlog.h:56
#define XLOG_HEAP2_NEW_CID
Definition: heapam_xlog.h:60
#define NULL
Definition: c.h:229
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_HEAP2_FREEZE_PAGE
Definition: heapam_xlog.h:55
void heap_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 35 of file heapdesc.c.

References appendStringInfo(), xl_heap_lock::flags, xl_heap_delete::infobits_set, xl_heap_lock::infobits_set, xl_heap_lock::locking_xid, xl_heap_update::new_offnum, xl_heap_update::new_xmax, xl_heap_delete::offnum, xl_heap_insert::offnum, xl_heap_lock::offnum, xl_heap_confirm::offnum, xl_heap_inplace::offnum, xl_heap_update::old_infobits_set, xl_heap_update::old_offnum, xl_heap_update::old_xmax, out_infobits(), XLOG_HEAP_CONFIRM, XLOG_HEAP_DELETE, XLOG_HEAP_HOT_UPDATE, XLOG_HEAP_INPLACE, XLOG_HEAP_INSERT, XLOG_HEAP_LOCK, XLOG_HEAP_OPMASK, XLOG_HEAP_UPDATE, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

36 {
37  char *rec = XLogRecGetData(record);
38  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
39 
40  info &= XLOG_HEAP_OPMASK;
41  if (info == XLOG_HEAP_INSERT)
42  {
43  xl_heap_insert *xlrec = (xl_heap_insert *) rec;
44 
45  appendStringInfo(buf, "off %u", xlrec->offnum);
46  }
47  else if (info == XLOG_HEAP_DELETE)
48  {
49  xl_heap_delete *xlrec = (xl_heap_delete *) rec;
50 
51  appendStringInfo(buf, "off %u ", xlrec->offnum);
52  out_infobits(buf, xlrec->infobits_set);
53  }
54  else if (info == XLOG_HEAP_UPDATE)
55  {
56  xl_heap_update *xlrec = (xl_heap_update *) rec;
57 
58  appendStringInfo(buf, "off %u xmax %u ",
59  xlrec->old_offnum,
60  xlrec->old_xmax);
61  out_infobits(buf, xlrec->old_infobits_set);
62  appendStringInfo(buf, "; new off %u xmax %u",
63  xlrec->new_offnum,
64  xlrec->new_xmax);
65  }
66  else if (info == XLOG_HEAP_HOT_UPDATE)
67  {
68  xl_heap_update *xlrec = (xl_heap_update *) rec;
69 
70  appendStringInfo(buf, "off %u xmax %u ",
71  xlrec->old_offnum,
72  xlrec->old_xmax);
73  out_infobits(buf, xlrec->old_infobits_set);
74  appendStringInfo(buf, "; new off %u xmax %u",
75  xlrec->new_offnum,
76  xlrec->new_xmax);
77  }
78  else if (info == XLOG_HEAP_CONFIRM)
79  {
80  xl_heap_confirm *xlrec = (xl_heap_confirm *) rec;
81 
82  appendStringInfo(buf, "off %u", xlrec->offnum);
83  }
84  else if (info == XLOG_HEAP_LOCK)
85  {
86  xl_heap_lock *xlrec = (xl_heap_lock *) rec;
87 
88  appendStringInfo(buf, "off %u: xid %u: flags %u ",
89  xlrec->offnum, xlrec->locking_xid, xlrec->flags);
90  out_infobits(buf, xlrec->infobits_set);
91  }
92  else if (info == XLOG_HEAP_INPLACE)
93  {
94  xl_heap_inplace *xlrec = (xl_heap_inplace *) rec;
95 
96  appendStringInfo(buf, "off %u", xlrec->offnum);
97  }
98 }
#define XLOG_HEAP_INSERT
Definition: heapam_xlog.h:32
uint8 old_infobits_set
Definition: heapam_xlog.h:192
OffsetNumber offnum
Definition: heapam_xlog.h:274
OffsetNumber offnum
Definition: heapam_xlog.h:253
TransactionId locking_xid
Definition: heapam_xlog.h:252
unsigned char uint8
Definition: c.h:266
#define XLOG_HEAP_OPMASK
Definition: heapam_xlog.h:41
#define XLOG_HEAP_HOT_UPDATE
Definition: heapam_xlog.h:36
OffsetNumber old_offnum
Definition: heapam_xlog.h:191
OffsetNumber offnum
Definition: heapam_xlog.h:105
#define XLogRecGetData(decoder)
Definition: xlogreader.h:218
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:110
TransactionId new_xmax
Definition: heapam_xlog.h:194
int8 infobits_set
Definition: heapam_xlog.h:254
static void out_infobits(StringInfo buf, uint8 infobits)
Definition: heapdesc.c:20
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:214
OffsetNumber offnum
Definition: heapam_xlog.h:282
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
uint8 infobits_set
Definition: heapam_xlog.h:106
#define XLOG_HEAP_UPDATE
Definition: heapam_xlog.h:34
#define XLOG_HEAP_INPLACE
Definition: heapam_xlog.h:39
#define XLOG_HEAP_LOCK
Definition: heapam_xlog.h:38
OffsetNumber new_offnum
Definition: heapam_xlog.h:195
#define XLOG_HEAP_DELETE
Definition: heapam_xlog.h:33
OffsetNumber offnum
Definition: heapam_xlog.h:132
TransactionId old_xmax
Definition: heapam_xlog.h:190
#define XLOG_HEAP_CONFIRM
Definition: heapam_xlog.h:37
const char* heap_identify ( uint8  info)

Definition at line 162 of file heapdesc.c.

References NULL, XLOG_HEAP_CONFIRM, XLOG_HEAP_DELETE, XLOG_HEAP_HOT_UPDATE, XLOG_HEAP_INIT_PAGE, XLOG_HEAP_INPLACE, XLOG_HEAP_INSERT, XLOG_HEAP_LOCK, XLOG_HEAP_UPDATE, and XLR_INFO_MASK.

163 {
164  const char *id = NULL;
165 
166  switch (info & ~XLR_INFO_MASK)
167  {
168  case XLOG_HEAP_INSERT:
169  id = "INSERT";
170  break;
172  id = "INSERT+INIT";
173  break;
174  case XLOG_HEAP_DELETE:
175  id = "DELETE";
176  break;
177  case XLOG_HEAP_UPDATE:
178  id = "UPDATE";
179  break;
181  id = "UPDATE+INIT";
182  break;
184  id = "HOT_UPDATE";
185  break;
187  id = "HOT_UPDATE+INIT";
188  break;
189  case XLOG_HEAP_CONFIRM:
190  id = "HEAP_CONFIRM";
191  break;
192  case XLOG_HEAP_LOCK:
193  id = "LOCK";
194  break;
195  case XLOG_HEAP_INPLACE:
196  id = "INPLACE";
197  break;
198  }
199 
200  return id;
201 }
#define XLOG_HEAP_INSERT
Definition: heapam_xlog.h:32
#define XLOG_HEAP_HOT_UPDATE
Definition: heapam_xlog.h:36
#define XLOG_HEAP_INIT_PAGE
Definition: heapam_xlog.h:46
#define NULL
Definition: c.h:229
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_HEAP_UPDATE
Definition: heapam_xlog.h:34
#define XLOG_HEAP_INPLACE
Definition: heapam_xlog.h:39
#define XLOG_HEAP_LOCK
Definition: heapam_xlog.h:38
#define XLOG_HEAP_DELETE
Definition: heapam_xlog.h:33
#define XLOG_HEAP_CONFIRM
Definition: heapam_xlog.h:37
static void out_infobits ( StringInfo  buf,
uint8  infobits 
)
static

Definition at line 20 of file heapdesc.c.

References appendStringInfoString(), XLHL_KEYS_UPDATED, XLHL_XMAX_EXCL_LOCK, XLHL_XMAX_IS_MULTI, XLHL_XMAX_KEYSHR_LOCK, and XLHL_XMAX_LOCK_ONLY.

Referenced by heap2_desc(), and heap_desc().

21 {
22  if (infobits & XLHL_XMAX_IS_MULTI)
23  appendStringInfoString(buf, "IS_MULTI ");
24  if (infobits & XLHL_XMAX_LOCK_ONLY)
25  appendStringInfoString(buf, "LOCK_ONLY ");
26  if (infobits & XLHL_XMAX_EXCL_LOCK)
27  appendStringInfoString(buf, "EXCL_LOCK ");
28  if (infobits & XLHL_XMAX_KEYSHR_LOCK)
29  appendStringInfoString(buf, "KEYSHR_LOCK ");
30  if (infobits & XLHL_KEYS_UPDATED)
31  appendStringInfoString(buf, "KEYS_UPDATED ");
32 }
#define XLHL_XMAX_LOCK_ONLY
Definition: heapam_xlog.h:241
#define XLHL_XMAX_IS_MULTI
Definition: heapam_xlog.h:240
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:189
#define XLHL_XMAX_EXCL_LOCK
Definition: heapam_xlog.h:242
#define XLHL_KEYS_UPDATED
Definition: heapam_xlog.h:244
#define XLHL_XMAX_KEYSHR_LOCK
Definition: heapam_xlog.h:243