PostgreSQL Source Code  git master
gistdesc.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * gistdesc.c
4  * rmgr descriptor routines for access/gist/gistxlog.c
5  *
6  * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/access/rmgrdesc/gistdesc.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include "access/gistxlog.h"
18 #include "lib/stringinfo.h"
19 #include "storage/relfilenode.h"
20 
21 static void
23 {
24 }
25 
26 static void
28 {
29  appendStringInfo(buf, "rel %u/%u/%u; blk %u; latestRemovedXid %u:%u",
30  xlrec->node.spcNode, xlrec->node.dbNode,
31  xlrec->node.relNode, xlrec->block,
34 }
35 
36 static void
38 {
39  appendStringInfo(buf, "delete: latestRemovedXid %u, nitems: %u",
40  xlrec->latestRemovedXid, xlrec->ntodelete);
41 
42 }
43 
44 static void
46 {
47  appendStringInfo(buf, "page_split: splits to %d pages",
48  xlrec->npage);
49 }
50 
51 static void
53 {
54  appendStringInfo(buf, "deleteXid %u:%u; downlink %u",
57  xlrec->downlinkOffset);
58 }
59 
60 void
62 {
63  char *rec = XLogRecGetData(record);
64  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
65 
66  switch (info)
67  {
70  break;
73  break;
74  case XLOG_GIST_DELETE:
75  out_gistxlogDelete(buf, (gistxlogDelete *) rec);
76  break;
79  break;
82  break;
83  }
84 }
85 
86 const char *
88 {
89  const char *id = NULL;
90 
91  switch (info & ~XLR_INFO_MASK)
92  {
94  id = "PAGE_UPDATE";
95  break;
96  case XLOG_GIST_DELETE:
97  id = "DELETE";
98  break;
100  id = "PAGE_REUSE";
101  break;
103  id = "PAGE_SPLIT";
104  break;
106  id = "PAGE_DELETE";
107  break;
108  }
109 
110  return id;
111 }
BlockNumber block
Definition: gistxlog.h:100
static void out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
Definition: gistdesc.c:45
unsigned char uint8
Definition: c.h:356
static void out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
Definition: gistdesc.c:37
RelFileNode node
Definition: gistxlog.h:99
#define XidFromFullTransactionId(x)
Definition: transam.h:48
FullTransactionId deleteXid
Definition: gistxlog.h:86
#define XLogRecGetData(decoder)
Definition: xlogreader.h:246
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
#define XLOG_GIST_PAGE_SPLIT
Definition: gistxlog.h:25
static void out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
Definition: gistdesc.c:22
uint16 ntodelete
Definition: gistxlog.h:52
static char * buf
Definition: pg_test_fsync.c:68
void gist_desc(StringInfo buf, XLogReaderState *record)
Definition: gistdesc.c:61
static void out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
Definition: gistdesc.c:27
#define XLOG_GIST_DELETE
Definition: gistxlog.h:21
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:242
#define XLOG_GIST_PAGE_REUSE
Definition: gistxlog.h:23
#define EpochFromFullTransactionId(x)
Definition: transam.h:47
const char * gist_identify(uint8 info)
Definition: gistdesc.c:87
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_GIST_PAGE_DELETE
Definition: gistxlog.h:28
TransactionId latestRemovedXid
Definition: gistxlog.h:51
static void out_gistxlogPageDelete(StringInfo buf, gistxlogPageDelete *xlrec)
Definition: gistdesc.c:52
#define XLOG_GIST_PAGE_UPDATE
Definition: gistxlog.h:20
FullTransactionId latestRemovedFullXid
Definition: gistxlog.h:101
OffsetNumber downlinkOffset
Definition: gistxlog.h:87