PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
xlogutils.h
Go to the documentation of this file.
1 /*
2  * xlogutils.h
3  *
4  * Utilities for replaying WAL records.
5  *
6  * Portions Copyright (c) 1996-2017, 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) */
35 
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);
43 
45  BlockNumber blkno, ReadBufferMode mode);
46 
48 extern void FreeFakeRelcacheEntry(Relation fakerel);
49 
51  XLogRecPtr targetPagePtr, int reqLen,
52  XLogRecPtr targetRecPtr, char *cur_page,
53  TimeLineID *pageTLI);
54 
56  XLogRecPtr wantPage, uint32 wantLength);
57 
58 #endif
uint32 TimeLineID
Definition: xlogdefs.h:45
XLogRedoAction XLogReadBufferForRedoExtended(XLogReaderState *record, uint8 buffer_id, ReadBufferMode mode, bool get_cleanup_lock, Buffer *buf)
Definition: xlogutils.c:327
unsigned char uint8
Definition: c.h:256
void XLogDropRelation(RelFileNode rnode, ForkNumber forknum)
Definition: xlogutils.c:607
Buffer XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum, BlockNumber blkno, ReadBufferMode mode)
Definition: xlogutils.c:438
uint32 BlockNumber
Definition: block.h:31
unsigned int Oid
Definition: postgres_ext.h:31
int read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI)
Definition: xlogutils.c:910
void XLogCheckInvalidPages(void)
Definition: xlogutils.c:221
Relation CreateFakeRelcacheEntry(RelFileNode rnode)
Definition: xlogutils.c:551
bool XLogHaveInvalidPages(void)
Definition: xlogutils.c:211
static char * buf
Definition: pg_test_fsync.c:67
unsigned int uint32
Definition: c.h:258
void FreeFakeRelcacheEntry(Relation fakerel)
Definition: xlogutils.c:592
ForkNumber
Definition: relpath.h:24
ReadBufferMode
Definition: bufmgr.h:38
XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, uint8 buffer_id, Buffer *buf)
Definition: xlogutils.c:290
uint64 XLogRecPtr
Definition: xlogdefs.h:21
Definition: regguts.h:298
void XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage, uint32 wantLength)
Definition: xlogutils.c:802
XLogRedoAction
Definition: xlogutils.h:27
Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id)
Definition: xlogutils.c:302
void XLogDropDatabase(Oid dbid)
Definition: xlogutils.c:618
int Buffer
Definition: buf.h:23
void XLogTruncateRelation(RelFileNode rnode, ForkNumber forkNum, BlockNumber nblocks)
Definition: xlogutils.c:637