1 /*-------------------------------------------------------------------------
4 * rmgr descriptor routines for access/gist/gistxlog.c
6 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
11 * src/backend/access/rmgrdesc/gistdesc.c
13 *-------------------------------------------------------------------------
17 #include "access/gistxlog.h"
18 #include "lib/stringinfo.h"
19 #include "storage/relfilelocator.h"
22 out_gistxlogPageUpdate(StringInfo buf
, gistxlogPageUpdate
*xlrec
)
27 out_gistxlogPageReuse(StringInfo buf
, gistxlogPageReuse
*xlrec
)
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
,
32 EpochFromFullTransactionId(xlrec
->snapshotConflictHorizon
),
33 XidFromFullTransactionId(xlrec
->snapshotConflictHorizon
));
37 out_gistxlogDelete(StringInfo buf
, gistxlogDelete
*xlrec
)
39 appendStringInfo(buf
, "delete: snapshotConflictHorizon %u, nitems: %u",
40 xlrec
->snapshotConflictHorizon
, xlrec
->ntodelete
);
44 out_gistxlogPageSplit(StringInfo buf
, gistxlogPageSplit
*xlrec
)
46 appendStringInfo(buf
, "page_split: splits to %d pages",
51 out_gistxlogPageDelete(StringInfo buf
, gistxlogPageDelete
*xlrec
)
53 appendStringInfo(buf
, "deleteXid %u:%u; downlink %u",
54 EpochFromFullTransactionId(xlrec
->deleteXid
),
55 XidFromFullTransactionId(xlrec
->deleteXid
),
56 xlrec
->downlinkOffset
);
60 gist_desc(StringInfo buf
, XLogReaderState
*record
)
62 char *rec
= XLogRecGetData(record
);
63 uint8 info
= XLogRecGetInfo(record
) & ~XLR_INFO_MASK
;
67 case XLOG_GIST_PAGE_UPDATE
:
68 out_gistxlogPageUpdate(buf
, (gistxlogPageUpdate
*) rec
);
70 case XLOG_GIST_PAGE_REUSE
:
71 out_gistxlogPageReuse(buf
, (gistxlogPageReuse
*) rec
);
73 case XLOG_GIST_DELETE
:
74 out_gistxlogDelete(buf
, (gistxlogDelete
*) rec
);
76 case XLOG_GIST_PAGE_SPLIT
:
77 out_gistxlogPageSplit(buf
, (gistxlogPageSplit
*) rec
);
79 case XLOG_GIST_PAGE_DELETE
:
80 out_gistxlogPageDelete(buf
, (gistxlogPageDelete
*) rec
);
82 case XLOG_GIST_ASSIGN_LSN
:
83 /* No details to write out */
89 gist_identify(uint8 info
)
91 const char *id
= NULL
;
93 switch (info
& ~XLR_INFO_MASK
)
95 case XLOG_GIST_PAGE_UPDATE
:
98 case XLOG_GIST_DELETE
:
101 case XLOG_GIST_PAGE_REUSE
:
104 case XLOG_GIST_PAGE_SPLIT
:
107 case XLOG_GIST_PAGE_DELETE
:
110 case XLOG_GIST_ASSIGN_LSN
: