1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/*-------------------------------------------------------------------------
*
* gistdesc.c
* rmgr descriptor routines for access/gist/gistxlog.c
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/backend/access/rmgrdesc/gistdesc.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/gistxlog.h"
#include "lib/stringinfo.h"
#include "storage/relfilenode.h"
static void
out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
{
}
static void
out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
{
appendStringInfo(buf, "rel %u/%u/%u; blk %u; latestRemovedXid %u:%u",
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode, xlrec->block,
EpochFromFullTransactionId(xlrec->latestRemovedFullXid),
XidFromFullTransactionId(xlrec->latestRemovedFullXid));
}
static void
out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
{
appendStringInfo(buf, "delete: latestRemovedXid %u, nitems: %u",
xlrec->latestRemovedXid, xlrec->ntodelete);
}
static void
out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
{
appendStringInfo(buf, "page_split: splits to %d pages",
xlrec->npage);
}
static void
out_gistxlogPageDelete(StringInfo buf, gistxlogPageDelete *xlrec)
{
appendStringInfo(buf, "deleteXid %u:%u; downlink %u",
EpochFromFullTransactionId(xlrec->deleteXid),
XidFromFullTransactionId(xlrec->deleteXid),
xlrec->downlinkOffset);
}
void
gist_desc(StringInfo buf, XLogReaderState *record)
{
char *rec = XLogRecGetData(record);
uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
switch (info)
{
case XLOG_GIST_PAGE_UPDATE:
out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
break;
case XLOG_GIST_PAGE_REUSE:
out_gistxlogPageReuse(buf, (gistxlogPageReuse *) rec);
break;
case XLOG_GIST_DELETE:
out_gistxlogDelete(buf, (gistxlogDelete *) rec);
break;
case XLOG_GIST_PAGE_SPLIT:
out_gistxlogPageSplit(buf, (gistxlogPageSplit *) rec);
break;
case XLOG_GIST_PAGE_DELETE:
out_gistxlogPageDelete(buf, (gistxlogPageDelete *) rec);
break;
case XLOG_GIST_ASSIGN_LSN:
/* No details to write out */
break;
}
}
const char *
gist_identify(uint8 info)
{
const char *id = NULL;
switch (info & ~XLR_INFO_MASK)
{
case XLOG_GIST_PAGE_UPDATE:
id = "PAGE_UPDATE";
break;
case XLOG_GIST_DELETE:
id = "DELETE";
break;
case XLOG_GIST_PAGE_REUSE:
id = "PAGE_REUSE";
break;
case XLOG_GIST_PAGE_SPLIT:
id = "PAGE_SPLIT";
break;
case XLOG_GIST_PAGE_DELETE:
id = "PAGE_DELETE";
break;
case XLOG_GIST_ASSIGN_LSN:
id = "ASSIGN_LSN";
break;
}
return id;
}
|