4 * Functions for generating WAL records
6 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/access/xloginsert.h
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 #include "utils/relcache.h"
22 * The minimum size of the WAL construction working area. If you need to
23 * register more than XLR_NORMAL_MAX_BLOCK_ID block references or have more
24 * than XLR_NORMAL_RDATAS data chunks in a single WAL record, you must call
25 * XLogEnsureRecordSpace() first to allocate more working memory.
27 #define XLR_NORMAL_MAX_BLOCK_ID 4
28 #define XLR_NORMAL_RDATAS 20
30 /* flags for XLogRegisterBuffer */
31 #define REGBUF_FORCE_IMAGE 0x01 /* force a full-page image */
32 #define REGBUF_NO_IMAGE 0x02 /* don't take a full-page image */
33 #define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized at
34 * replay (implies NO_IMAGE) */
35 #define REGBUF_STANDARD 0x08 /* page follows "standard" page layout,
36 * (data between pd_lower and pd_upper
38 #define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image
41 /* prototypes for public functions in xloginsert.c: */
42 extern void XLogBeginInsert(void);
43 extern void XLogSetRecordFlags(uint8 flags
);
44 extern XLogRecPtr
XLogInsert(RmgrId rmid
, uint8 info
);
45 extern void XLogEnsureRecordSpace(int max_block_id
, int ndatas
);
46 extern void XLogRegisterData(char *data
, int len
);
47 extern void XLogRegisterBuffer(uint8 block_id
, Buffer buffer
, uint8 flags
);
48 extern void XLogRegisterBlock(uint8 block_id
, RelFileNode
*rnode
,
49 ForkNumber forknum
, BlockNumber blknum
, char *page
,
51 extern void XLogRegisterBufData(uint8 block_id
, char *data
, int len
);
52 extern void XLogResetInsertion(void);
53 extern bool XLogCheckBufferNeedsBackup(Buffer buffer
);
55 extern XLogRecPtr
log_newpage(RelFileNode
*rnode
, ForkNumber forkNum
,
56 BlockNumber blk
, char *page
, bool page_std
);
57 extern void log_newpages(RelFileNode
*rnode
, ForkNumber forkNum
, int num_pages
,
58 BlockNumber
*blknos
, char **pages
, bool page_std
);
59 extern XLogRecPtr
log_newpage_buffer(Buffer buffer
, bool page_std
);
60 extern void log_newpage_range(Relation rel
, ForkNumber forkNum
,
61 BlockNumber startblk
, BlockNumber endblk
, bool page_std
);
62 extern XLogRecPtr
XLogSaveBufferForHint(Buffer buffer
, bool buffer_std
);
64 extern void InitXLogInsert(void);
66 #endif /* XLOGINSERT_H */