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-2024, 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 
20 static void
22 {
23 }
24 
25 static void
27 {
28  appendStringInfo(buf, "rel %u/%u/%u; blk %u; snapshotConflictHorizon %u:%u, isCatalogRel %c",
29  xlrec->locator.spcOid, xlrec->locator.dbOid,
30  xlrec->locator.relNumber, xlrec->block,
33  xlrec->isCatalogRel ? 'T' : 'F');
34 }
35 
36 static void
38 {
39  appendStringInfo(buf, "delete: snapshotConflictHorizon %u, nitems: %u, isCatalogRel %c",
40  xlrec->snapshotConflictHorizon, xlrec->ntodelete,
41  xlrec->isCatalogRel ? 'T' : 'F');
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:
76  break;
79  break;
82  break;
84  /* No details to write out */
85  break;
86  }
87 }
88 
89 const char *
91 {
92  const char *id = NULL;
93 
94  switch (info & ~XLR_INFO_MASK)
95  {
97  id = "PAGE_UPDATE";
98  break;
99  case XLOG_GIST_DELETE:
100  id = "DELETE";
101  break;
103  id = "PAGE_REUSE";
104  break;
106  id = "PAGE_SPLIT";
107  break;
109  id = "PAGE_DELETE";
110  break;
112  id = "ASSIGN_LSN";
113  break;
114  }
115 
116  return id;
117 }
uint8_t uint8
Definition: c.h:483
const char * gist_identify(uint8 info)
Definition: gistdesc.c:90
void gist_desc(StringInfo buf, XLogReaderState *record)
Definition: gistdesc.c:61
static void out_gistxlogPageDelete(StringInfo buf, gistxlogPageDelete *xlrec)
Definition: gistdesc.c:52
static void out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
Definition: gistdesc.c:21
static void out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
Definition: gistdesc.c:45
static void out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
Definition: gistdesc.c:37
static void out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
Definition: gistdesc.c:26
#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:72
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:94
RelFileNumber relNumber
bool isCatalogRel
Definition: gistxlog.h:52
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