PostgreSQL Source Code  git master
Go to the documentation of this file.
1 /*
2  * xlogutils.h
3  *
4  * Utilities for replaying WAL records.
5  *
6  * Portions Copyright (c) 1996-2020, 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
14 #include "access/xlogreader.h"
15 #include "storage/bufmgr.h"
18 extern bool XLogHaveInvalidPages(void);
19 extern void XLogCheckInvalidPages(void);
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);
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) */
37  uint8 buffer_id, Buffer *buf);
38 extern Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id);
40  uint8 buffer_id,
41  ReadBufferMode mode, bool get_cleanup_lock,
42  Buffer *buf);
48 extern void FreeFakeRelcacheEntry(Relation fakerel);
51  XLogRecPtr targetPagePtr, int reqLen,
52  XLogRecPtr targetRecPtr, char *cur_page);
54  XLogSegNo nextSegNo,
55  TimeLineID *tli_p);
59  XLogRecPtr wantPage, uint32 wantLength);
61 extern void WALReadRaiseError(WALReadError *errinfo);
63 #endif
static PgChecksumMode mode
Definition: pg_checksums.c:61
uint32 TimeLineID
Definition: xlogdefs.h:52
XLogRedoAction XLogReadBufferForRedoExtended(XLogReaderState *record, uint8 buffer_id, ReadBufferMode mode, bool get_cleanup_lock, Buffer *buf)
Definition: xlogutils.c:330
unsigned char uint8
Definition: c.h:372
void XLogDropRelation(RelFileNode rnode, ForkNumber forknum)
Definition: xlogutils.c:614
Buffer XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum, BlockNumber blkno, ReadBufferMode mode)
Definition: xlogutils.c:441
uint32 BlockNumber
Definition: block.h:31
unsigned int Oid
Definition: postgres_ext.h:31
void wal_segment_close(XLogReaderState *state)
Definition: xlogutils.c:812
void XLogCheckInvalidPages(void)
Definition: xlogutils.c:224
Relation CreateFakeRelcacheEntry(RelFileNode rnode)
Definition: xlogutils.c:556
bool XLogHaveInvalidPages(void)
Definition: xlogutils.c:214
static char * buf
Definition: pg_test_fsync.c:67
uint64 XLogSegNo
Definition: xlogdefs.h:41
unsigned int uint32
Definition: c.h:374
void FreeFakeRelcacheEntry(Relation fakerel)
Definition: xlogutils.c:599
Definition: relpath.h:40
Definition: bufmgr.h:37
void wal_segment_open(XLogReaderState *state, XLogSegNo nextSegNo, TimeLineID *tli_p)
Definition: xlogutils.c:787
XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, uint8 buffer_id, Buffer *buf)
Definition: xlogutils.c:293
int read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *cur_page)
Definition: xlogutils.c:831
uint64 XLogRecPtr
Definition: xlogdefs.h:21
Definition: regguts.h:298
void XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage, uint32 wantLength)
Definition: xlogutils.c:689
Definition: xlogutils.h:27
void WALReadRaiseError(WALReadError *errinfo)
Definition: xlogutils.c:958
Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id)
Definition: xlogutils.c:305
void XLogDropDatabase(Oid dbid)
Definition: xlogutils.c:625
int Buffer
Definition: buf.h:23
void XLogTruncateRelation(RelFileNode rnode, ForkNumber forkNum, BlockNumber nblocks)
Definition: xlogutils.c:644