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-2023, 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/relfilelocator.h"
20 
21 static void
23 {
24 }
25 
26 static void
28 {
29  appendStringInfo(buf, "rel %u/%u/%u; blk %u; snapshotConflictHorizon %u:%u",
30  xlrec->locator.spcOid, xlrec->locator.dbOid,
31  xlrec->locator.relNumber, xlrec->block,
34 }
35 
36 static void
38 {
39  appendStringInfo(buf, "delete: snapshotConflictHorizon %u, nitems: %u",
40  xlrec->snapshotConflictHorizon, xlrec->ntodelete);
41 }
42 
43 static void
45 {
46  appendStringInfo(buf, "page_split: splits to %d pages",
47  xlrec->npage);
48 }
49 
50 static void
52 {
53  appendStringInfo(buf, "deleteXid %u:%u; downlink %u",
56  xlrec->downlinkOffset);
57 }
58 
59 void
61 {
62  char *rec = XLogRecGetData(record);
63  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
64 
65  switch (info)
66  {
69  break;
72  break;
73  case XLOG_GIST_DELETE:
75  break;
78  break;
81  break;
83  /* No details to write out */
84  break;
85  }
86 }
87 
88 const char *
90 {
91  const char *id = NULL;
92 
93  switch (info & ~XLR_INFO_MASK)
94  {
96  id = "PAGE_UPDATE";
97  break;
98  case XLOG_GIST_DELETE:
99  id = "DELETE";
100  break;
102  id = "PAGE_REUSE";
103  break;
105  id = "PAGE_SPLIT";
106  break;
108  id = "PAGE_DELETE";
109  break;
111  id = "ASSIGN_LSN";
112  break;
113  }
114 
115  return id;
116 }
unsigned char uint8
Definition: c.h:493
const char * gist_identify(uint8 info)
Definition: gistdesc.c:89
void gist_desc(StringInfo buf, XLogReaderState *record)
Definition: gistdesc.c:60
static void out_gistxlogPageDelete(StringInfo buf, gistxlogPageDelete *xlrec)
Definition: gistdesc.c:51
static void out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
Definition: gistdesc.c:22
static void out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
Definition: gistdesc.c:44
static void out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
Definition: gistdesc.c:37
static void out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
Definition: gistdesc.c:27
#define XLOG_GIST_ASSIGN_LSN
Definition: gistxlog.h:27
#define XLOG_GIST_PAGE_REUSE
Definition: gistxlog.h:22
#define XLOG_GIST_PAGE_DELETE
Definition: gistxlog.h:26
#define XLOG_GIST_DELETE
Definition: gistxlog.h:21
#define XLOG_GIST_PAGE_SPLIT
Definition: gistxlog.h:23
#define XLOG_GIST_PAGE_UPDATE
Definition: gistxlog.h:20
static char * buf
Definition: pg_test_fsync.c:73
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:97
RelFileNumber relNumber
TransactionId snapshotConflictHorizon
Definition: gistxlog.h:50
uint16 ntodelete
Definition: gistxlog.h:51
FullTransactionId deleteXid
Definition: gistxlog.h:86
OffsetNumber downlinkOffset
Definition: gistxlog.h:87
RelFileLocator locator
Definition: gistxlog.h:99
BlockNumber block
Definition: gistxlog.h:100
FullTransactionId snapshotConflictHorizon
Definition: gistxlog.h:101
#define EpochFromFullTransactionId(x)
Definition: transam.h:47
#define XidFromFullTransactionId(x)
Definition: transam.h:48
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:410
#define XLogRecGetData(decoder)
Definition: xlogreader.h:415
#define XLR_INFO_MASK
Definition: xlogrecord.h:62