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

Go to the source code of this file.

Functions

void brin_desc (StringInfo buf, XLogReaderState *record)
 
const char * brin_identify (uint8 info)
 

Function Documentation

◆ brin_desc()

void brin_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 20 of file brindesc.c.

21 {
22  char *rec = XLogRecGetData(record);
23  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
24 
25  info &= XLOG_BRIN_OPMASK;
26  if (info == XLOG_BRIN_CREATE_INDEX)
27  {
28  xl_brin_createidx *xlrec = (xl_brin_createidx *) rec;
29 
30  appendStringInfo(buf, "v%d pagesPerRange %u",
31  xlrec->version, xlrec->pagesPerRange);
32  }
33  else if (info == XLOG_BRIN_INSERT)
34  {
35  xl_brin_insert *xlrec = (xl_brin_insert *) rec;
36 
37  appendStringInfo(buf, "heapBlk %u pagesPerRange %u offnum %u",
38  xlrec->heapBlk,
39  xlrec->pagesPerRange,
40  xlrec->offnum);
41  }
42  else if (info == XLOG_BRIN_UPDATE)
43  {
44  xl_brin_update *xlrec = (xl_brin_update *) rec;
45 
46  appendStringInfo(buf, "heapBlk %u pagesPerRange %u old offnum %u, new offnum %u",
47  xlrec->insert.heapBlk,
48  xlrec->insert.pagesPerRange,
49  xlrec->oldOffnum,
50  xlrec->insert.offnum);
51  }
52  else if (info == XLOG_BRIN_SAMEPAGE_UPDATE)
53  {
55 
56  appendStringInfo(buf, "offnum %u", xlrec->offnum);
57  }
58  else if (info == XLOG_BRIN_REVMAP_EXTEND)
59  {
61 
62  appendStringInfo(buf, "targetBlk %u", xlrec->targetBlk);
63  }
64  else if (info == XLOG_BRIN_DESUMMARIZE)
65  {
67 
68  appendStringInfo(buf, "pagesPerRange %u, heapBlk %u, page offset %u",
69  xlrec->pagesPerRange, xlrec->heapBlk, xlrec->regOffset);
70  }
71 }
#define XLOG_BRIN_REVMAP_EXTEND
Definition: brin_xlog.h:35
#define XLOG_BRIN_SAMEPAGE_UPDATE
Definition: brin_xlog.h:34
#define XLOG_BRIN_DESUMMARIZE
Definition: brin_xlog.h:36
#define XLOG_BRIN_CREATE_INDEX
Definition: brin_xlog.h:31
#define XLOG_BRIN_OPMASK
Definition: brin_xlog.h:38
#define XLOG_BRIN_UPDATE
Definition: brin_xlog.h:33
#define XLOG_BRIN_INSERT
Definition: brin_xlog.h:32
uint8_t uint8
Definition: c.h:483
static char * buf
Definition: pg_test_fsync.c:72
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:94
BlockNumber pagesPerRange
Definition: brin_xlog.h:52
BlockNumber pagesPerRange
Definition: brin_xlog.h:135
BlockNumber heapBlk
Definition: brin_xlog.h:137
OffsetNumber regOffset
Definition: brin_xlog.h:139
OffsetNumber offnum
Definition: brin_xlog.h:71
BlockNumber pagesPerRange
Definition: brin_xlog.h:68
BlockNumber heapBlk
Definition: brin_xlog.h:65
BlockNumber targetBlk
Definition: brin_xlog.h:121
OffsetNumber offnum
Definition: brin_xlog.h:104
OffsetNumber oldOffnum
Definition: brin_xlog.h:90
xl_brin_insert insert
Definition: brin_xlog.h:92
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:410
#define XLogRecGetData(decoder)
Definition: xlogreader.h:415
#define XLR_INFO_MASK
Definition: xlogrecord.h:62

References appendStringInfo(), buf, xl_brin_insert::heapBlk, xl_brin_desummarize::heapBlk, xl_brin_update::insert, xl_brin_insert::offnum, xl_brin_samepage_update::offnum, xl_brin_update::oldOffnum, xl_brin_createidx::pagesPerRange, xl_brin_insert::pagesPerRange, xl_brin_desummarize::pagesPerRange, xl_brin_desummarize::regOffset, xl_brin_revmap_extend::targetBlk, xl_brin_createidx::version, XLOG_BRIN_CREATE_INDEX, XLOG_BRIN_DESUMMARIZE, XLOG_BRIN_INSERT, XLOG_BRIN_OPMASK, XLOG_BRIN_REVMAP_EXTEND, XLOG_BRIN_SAMEPAGE_UPDATE, XLOG_BRIN_UPDATE, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

◆ brin_identify()

const char* brin_identify ( uint8  info)

Definition at line 74 of file brindesc.c.

75 {
76  const char *id = NULL;
77 
78  switch (info & ~XLR_INFO_MASK)
79  {
81  id = "CREATE_INDEX";
82  break;
83  case XLOG_BRIN_INSERT:
84  id = "INSERT";
85  break;
87  id = "INSERT+INIT";
88  break;
89  case XLOG_BRIN_UPDATE:
90  id = "UPDATE";
91  break;
93  id = "UPDATE+INIT";
94  break;
96  id = "SAMEPAGE_UPDATE";
97  break;
99  id = "REVMAP_EXTEND";
100  break;
102  id = "DESUMMARIZE";
103  break;
104  }
105 
106  return id;
107 }
#define XLOG_BRIN_INIT_PAGE
Definition: brin_xlog.h:43

References XLOG_BRIN_CREATE_INDEX, XLOG_BRIN_DESUMMARIZE, XLOG_BRIN_INIT_PAGE, XLOG_BRIN_INSERT, XLOG_BRIN_REVMAP_EXTEND, XLOG_BRIN_SAMEPAGE_UPDATE, XLOG_BRIN_UPDATE, and XLR_INFO_MASK.