1 /*-------------------------------------------------------------------------
6 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/access/gistxlog.h
11 *-------------------------------------------------------------------------
16 #include "access/gist.h"
17 #include "access/xlogreader.h"
18 #include "lib/stringinfo.h"
20 #define XLOG_GIST_PAGE_UPDATE 0x00
21 #define XLOG_GIST_DELETE 0x10 /* delete leaf index tuples for a
23 #define XLOG_GIST_PAGE_REUSE 0x20 /* old page is about to be reused
25 #define XLOG_GIST_PAGE_SPLIT 0x30
26 /* #define XLOG_GIST_INSERT_COMPLETE 0x40 */ /* not used anymore */
27 /* #define XLOG_GIST_CREATE_INDEX 0x50 */ /* not used anymore */
28 #define XLOG_GIST_PAGE_DELETE 0x60
29 #define XLOG_GIST_ASSIGN_LSN 0x70 /* nop, assign new LSN */
32 * Backup Blk 0: updated page.
33 * Backup Blk 1: If this operation completes a page split, by inserting a
34 * downlink for the split page, the left half of the split
36 typedef struct gistxlogPageUpdate
38 /* number of deleted offsets */
43 * In payload of blk 0 : 1. todelete OffsetNumbers 2. tuples to insert
48 * Backup Blk 0: Leaf page, whose index tuples are deleted.
50 typedef struct gistxlogDelete
52 TransactionId snapshotConflictHorizon
;
53 uint16 ntodelete
; /* number of deleted offsets */
54 bool isCatalogRel
; /* to handle recovery conflict during logical
55 * decoding on standby */
57 /* TODELETE OFFSET NUMBERS */
58 OffsetNumber offsets
[FLEXIBLE_ARRAY_MEMBER
];
61 #define SizeOfGistxlogDelete offsetof(gistxlogDelete, offsets)
64 * Backup Blk 0: If this operation completes a page split, by inserting a
65 * downlink for the split page, the left half of the split
66 * Backup Blk 1 - npage: split pages (1 is the original page)
68 typedef struct gistxlogPageSplit
70 BlockNumber origrlink
; /* rightlink of the page before split */
71 GistNSN orignsn
; /* NSN of the page before split */
72 bool origleaf
; /* was split page a leaf page? */
74 uint16 npage
; /* # of pages in the split */
75 bool markfollowright
; /* set F_FOLLOW_RIGHT flags */
78 * follow: 1. gistxlogPage and array of IndexTupleData per page
83 * Backup Blk 0: page that was deleted.
84 * Backup Blk 1: parent page, containing the downlink to the deleted page.
86 typedef struct gistxlogPageDelete
88 FullTransactionId deleteXid
; /* last Xid which could see page in scan */
89 OffsetNumber downlinkOffset
; /* Offset of downlink referencing this
93 #define SizeOfGistxlogPageDelete (offsetof(gistxlogPageDelete, downlinkOffset) + sizeof(OffsetNumber))
97 * This is what we need to know about page reuse, for hot standby.
99 typedef struct gistxlogPageReuse
101 RelFileLocator locator
;
103 FullTransactionId snapshotConflictHorizon
;
104 bool isCatalogRel
; /* to handle recovery conflict during logical
105 * decoding on standby */
108 #define SizeOfGistxlogPageReuse (offsetof(gistxlogPageReuse, isCatalogRel) + sizeof(bool))
110 extern void gist_redo(XLogReaderState
*record
);
111 extern void gist_desc(StringInfo buf
, XLogReaderState
*record
);
112 extern const char *gist_identify(uint8 info
);
113 extern void gist_xlog_startup(void);
114 extern void gist_xlog_cleanup(void);
115 extern void gist_mask(char *pagedata
, BlockNumber blkno
);