PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
xloginsert.h
Go to the documentation of this file.
1 /*
2  * xloginsert.h
3  *
4  * Functions for generating 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/xloginsert.h
10  */
11 #ifndef XLOGINSERT_H
12 #define XLOGINSERT_H
13 
14 #include "access/rmgr.h"
15 #include "access/xlogdefs.h"
16 #include "storage/block.h"
17 #include "storage/buf.h"
18 #include "storage/relfilenode.h"
19 
20 /*
21  * The minimum size of the WAL construction working area. If you need to
22  * register more than XLR_NORMAL_MAX_BLOCK_ID block references or have more
23  * than XLR_NORMAL_RDATAS data chunks in a single WAL record, you must call
24  * XLogEnsureRecordSpace() first to allocate more working memory.
25  */
26 #define XLR_NORMAL_MAX_BLOCK_ID 4
27 #define XLR_NORMAL_RDATAS 20
28 
29 /* flags for XLogRegisterBuffer */
30 #define REGBUF_FORCE_IMAGE 0x01 /* force a full-page image */
31 #define REGBUF_NO_IMAGE 0x02 /* don't take a full-page image */
32 #define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized at
33  * replay (implies NO_IMAGE) */
34 #define REGBUF_STANDARD 0x08 /* page follows "standard" page layout,
35  * (data between pd_lower and pd_upper
36  * will be skipped) */
37 #define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image
38  * is taken */
39 
40 /* prototypes for public functions in xloginsert.c: */
41 extern void XLogBeginInsert(void);
42 extern void XLogSetRecordFlags(uint8 flags);
43 extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info);
44 extern void XLogEnsureRecordSpace(int nbuffers, int ndatas);
45 extern void XLogRegisterData(char *data, int len);
46 extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags);
47 extern void XLogRegisterBlock(uint8 block_id, RelFileNode *rnode,
48  ForkNumber forknum, BlockNumber blknum, char *page,
49  uint8 flags);
50 extern void XLogRegisterBufData(uint8 block_id, char *data, int len);
51 extern void XLogResetInsertion(void);
53 
54 extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum,
55  BlockNumber blk, char *page, bool page_std);
56 extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std);
57 extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);
58 
59 extern void InitXLogInsert(void);
60 
61 #endif /* XLOGINSERT_H */
void XLogRegisterData(char *data, int len)
Definition: xloginsert.c:323
void XLogEnsureRecordSpace(int nbuffers, int ndatas)
Definition: xloginsert.c:146
void XLogSetRecordFlags(uint8 flags)
Definition: xloginsert.c:397
void XLogRegisterBlock(uint8 block_id, RelFileNode *rnode, ForkNumber forknum, BlockNumber blknum, char *page, uint8 flags)
Definition: xloginsert.c:266
void XLogResetInsertion(void)
Definition: xloginsert.c:193
unsigned char uint8
Definition: c.h:256
uint32 BlockNumber
Definition: block.h:31
XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std)
Definition: xloginsert.c:1009
bool XLogCheckBufferNeedsBackup(Buffer buffer)
Definition: xloginsert.c:855
XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum, BlockNumber blk, char *page, bool page_std)
Definition: xloginsert.c:972
XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std)
Definition: xloginsert.c:893
void XLogRegisterBufData(uint8 block_id, char *data, int len)
Definition: xloginsert.c:361
ForkNumber
Definition: relpath.h:24
void InitXLogInsert(void)
Definition: xloginsert.c:1028
uint8 RmgrId
Definition: rmgr.h:11
void XLogBeginInsert(void)
Definition: xloginsert.c:120
uint64 XLogRecPtr
Definition: xlogdefs.h:21
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
Definition: xloginsert.c:213
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:214
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
Definition: xloginsert.c:415
int Buffer
Definition: buf.h:23