Age Owner Branch data TLA Line data Source code
1 : : /*-------------------------------------------------------------------------
2 : : *
3 : : * gistdesc.c
4 : : * rmgr descriptor routines for access/gist/gistxlog.c
5 : : *
6 : : * Portions Copyright (c) 1996-2025, 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
4665 alvherre@alvh.no-ip. 21 :CBC 18 : out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
22 : : {
23 : 18 : }
24 : :
25 : : static void
2360 heikki.linnakangas@i 26 :UBC 0 : out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
27 : : {
625 msawada@postgresql.o 28 : 0 : 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,
1024 pg@bowt.ie 31 : 0 : EpochFromFullTransactionId(xlrec->snapshotConflictHorizon),
625 msawada@postgresql.o 32 : 0 : XidFromFullTransactionId(xlrec->snapshotConflictHorizon),
33 [ # # ]: 0 : xlrec->isCatalogRel ? 'T' : 'F');
2360 heikki.linnakangas@i 34 : 0 : }
35 : :
36 : : static void
2329 andres@anarazel.de 37 : 0 : out_gistxlogDelete(StringInfo buf, gistxlogDelete *xlrec)
38 : : {
625 msawada@postgresql.o 39 : 0 : appendStringInfo(buf, "delete: snapshotConflictHorizon %u, nitems: %u, isCatalogRel %c",
40 : 0 : xlrec->snapshotConflictHorizon, xlrec->ntodelete,
41 [ # # ]: 0 : xlrec->isCatalogRel ? 'T' : 'F');
2451 akorotkov@postgresql 42 : 0 : }
43 : :
44 : : static void
4665 alvherre@alvh.no-ip. 45 : 0 : out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
46 : : {
3943 heikki.linnakangas@i 47 : 0 : appendStringInfo(buf, "page_split: splits to %d pages",
48 : 0 : xlrec->npage);
4665 alvherre@alvh.no-ip. 49 : 0 : }
50 : :
51 : : static void
2360 heikki.linnakangas@i 52 : 0 : out_gistxlogPageDelete(StringInfo buf, gistxlogPageDelete *xlrec)
53 : : {
2236 54 : 0 : appendStringInfo(buf, "deleteXid %u:%u; downlink %u",
55 : 0 : EpochFromFullTransactionId(xlrec->deleteXid),
56 : 0 : XidFromFullTransactionId(xlrec->deleteXid),
57 : 0 : xlrec->downlinkOffset);
2360 58 : 0 : }
59 : :
60 : : void
3943 heikki.linnakangas@i 61 :CBC 18 : gist_desc(StringInfo buf, XLogReaderState *record)
62 : : {
4102 63 : 18 : char *rec = XLogRecGetData(record);
3943 64 : 18 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
65 : :
4665 alvherre@alvh.no-ip. 66 [ + - - - : 18 : switch (info)
- - - ]
67 : : {
68 : 18 : case XLOG_GIST_PAGE_UPDATE:
69 : 18 : out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
70 : 18 : break;
2360 heikki.linnakangas@i 71 :UBC 0 : case XLOG_GIST_PAGE_REUSE:
72 : 0 : out_gistxlogPageReuse(buf, (gistxlogPageReuse *) rec);
73 : 0 : break;
2451 akorotkov@postgresql 74 : 0 : case XLOG_GIST_DELETE:
2329 andres@anarazel.de 75 : 0 : out_gistxlogDelete(buf, (gistxlogDelete *) rec);
2451 akorotkov@postgresql 76 : 0 : break;
4665 alvherre@alvh.no-ip. 77 : 0 : case XLOG_GIST_PAGE_SPLIT:
78 : 0 : out_gistxlogPageSplit(buf, (gistxlogPageSplit *) rec);
79 : 0 : break;
2360 heikki.linnakangas@i 80 : 0 : case XLOG_GIST_PAGE_DELETE:
81 : 0 : out_gistxlogPageDelete(buf, (gistxlogPageDelete *) rec);
82 : 0 : break;
1981 noah@leadboat.com 83 : 0 : case XLOG_GIST_ASSIGN_LSN:
84 : : /* No details to write out */
85 : 0 : break;
86 : : }
4005 andres@anarazel.de 87 :CBC 18 : }
88 : :
89 : : const char *
90 : 19 : gist_identify(uint8 info)
91 : : {
92 : 19 : const char *id = NULL;
93 : :
4002 94 [ + - - - : 19 : switch (info & ~XLR_INFO_MASK)
- - - ]
95 : : {
4005 96 : 19 : case XLOG_GIST_PAGE_UPDATE:
97 : 19 : id = "PAGE_UPDATE";
98 : 19 : break;
2451 akorotkov@postgresql 99 :UBC 0 : case XLOG_GIST_DELETE:
100 : 0 : id = "DELETE";
101 : 0 : break;
2360 heikki.linnakangas@i 102 : 0 : case XLOG_GIST_PAGE_REUSE:
103 : 0 : id = "PAGE_REUSE";
104 : 0 : break;
4005 andres@anarazel.de 105 : 0 : case XLOG_GIST_PAGE_SPLIT:
106 : 0 : id = "PAGE_SPLIT";
107 : 0 : break;
2360 heikki.linnakangas@i 108 : 0 : case XLOG_GIST_PAGE_DELETE:
109 : 0 : id = "PAGE_DELETE";
110 : 0 : break;
1981 noah@leadboat.com 111 : 0 : case XLOG_GIST_ASSIGN_LSN:
112 : 0 : id = "ASSIGN_LSN";
113 : 0 : break;
114 : : }
115 : :
4005 andres@anarazel.de 116 :CBC 19 : return id;
117 : : }
|