1 | /* |
2 | * xlogutils.h |
3 | * |
4 | * Utilities for replaying WAL records. |
5 | * |
6 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
7 | * Portions Copyright (c) 1994, Regents of the University of California |
8 | * |
9 | * src/include/access/xlogutils.h |
10 | */ |
11 | #ifndef XLOG_UTILS_H |
12 | #define XLOG_UTILS_H |
13 | |
14 | #include "access/xlogreader.h" |
15 | #include "storage/bufmgr.h" |
16 | |
17 | |
18 | extern bool XLogHaveInvalidPages(void); |
19 | extern void XLogCheckInvalidPages(void); |
20 | |
21 | extern void XLogDropRelation(RelFileNode rnode, ForkNumber forknum); |
22 | extern void XLogDropDatabase(Oid dbid); |
23 | extern void XLogTruncateRelation(RelFileNode rnode, ForkNumber forkNum, |
24 | BlockNumber nblocks); |
25 | |
26 | /* Result codes for XLogReadBufferForRedo[Extended] */ |
27 | typedef enum |
28 | { |
29 | BLK_NEEDS_REDO, /* changes from WAL record need to be applied */ |
30 | BLK_DONE, /* block is already up-to-date */ |
31 | BLK_RESTORED, /* block was restored from a full-page image */ |
32 | BLK_NOTFOUND /* block was not found (and hence does not |
33 | * need to be replayed) */ |
34 | } XLogRedoAction; |
35 | |
36 | extern XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, |
37 | uint8 buffer_id, Buffer *buf); |
38 | extern Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id); |
39 | extern XLogRedoAction XLogReadBufferForRedoExtended(XLogReaderState *record, |
40 | uint8 buffer_id, |
41 | ReadBufferMode mode, bool get_cleanup_lock, |
42 | Buffer *buf); |
43 | |
44 | extern Buffer XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum, |
45 | BlockNumber blkno, ReadBufferMode mode); |
46 | |
47 | extern Relation CreateFakeRelcacheEntry(RelFileNode rnode); |
48 | extern void FreeFakeRelcacheEntry(Relation fakerel); |
49 | |
50 | extern int read_local_xlog_page(XLogReaderState *state, |
51 | XLogRecPtr targetPagePtr, int reqLen, |
52 | XLogRecPtr targetRecPtr, char *cur_page, |
53 | TimeLineID *pageTLI); |
54 | |
55 | extern void XLogReadDetermineTimeline(XLogReaderState *state, |
56 | XLogRecPtr wantPage, uint32 wantLength); |
57 | |
58 | #endif |
59 | |