PostgreSQL Source Code  git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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-2024, 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/relfilelocator.h"
19 #include "utils/relcache.h"
20 
21 /*
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.
26  */
27 #define XLR_NORMAL_MAX_BLOCK_ID 4
28 #define XLR_NORMAL_RDATAS 20
29 
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
37  * will be skipped) */
38 #define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image
39  * is taken */
40 #define REGBUF_NO_CHANGE 0x20 /* intentionally register clean buffer */
41 
42 /* prototypes for public functions in xloginsert.c: */
43 extern void XLogBeginInsert(void);
44 extern void XLogSetRecordFlags(uint8 flags);
45 extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info);
46 extern void XLogEnsureRecordSpace(int max_block_id, int ndatas);
47 extern void XLogRegisterData(const char *data, uint32 len);
48 extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags);
49 extern void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator,
50  ForkNumber forknum, BlockNumber blknum, const char *page,
51  uint8 flags);
52 extern void XLogRegisterBufData(uint8 block_id, const char *data, uint32 len);
53 extern void XLogResetInsertion(void);
54 extern bool XLogCheckBufferNeedsBackup(Buffer buffer);
55 
56 extern XLogRecPtr log_newpage(RelFileLocator *rlocator, ForkNumber forknum,
57  BlockNumber blkno, char *page, bool page_std);
58 extern void log_newpages(RelFileLocator *rlocator, ForkNumber forknum, int num_pages,
59  BlockNumber *blknos, char **pages, bool page_std);
60 extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std);
61 extern void log_newpage_range(Relation rel, ForkNumber forknum,
62  BlockNumber startblk, BlockNumber endblk, bool page_std);
63 extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);
64 
65 extern void InitXLogInsert(void);
66 
67 #endif /* XLOGINSERT_H */
uint32 BlockNumber
Definition: block.h:31
int Buffer
Definition: buf.h:23
unsigned int uint32
Definition: c.h:492
unsigned char uint8
Definition: c.h:490
const void size_t len
const void * data
ForkNumber
Definition: relpath.h:56
uint8 RmgrId
Definition: rmgr.h:11
uint64 XLogRecPtr
Definition: xlogdefs.h:21
void XLogRegisterBufData(uint8 block_id, const char *data, uint32 len)
Definition: xloginsert.c:405
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
Definition: xloginsert.c:474
bool XLogCheckBufferNeedsBackup(Buffer buffer)
Definition: xloginsert.c:1027
XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std)
Definition: xloginsert.c:1065
void InitXLogInsert(void)
Definition: xloginsert.c:1348
void XLogSetRecordFlags(uint8 flags)
Definition: xloginsert.c:456
void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator, ForkNumber forknum, BlockNumber blknum, const char *page, uint8 flags)
Definition: xloginsert.c:309
void XLogRegisterData(const char *data, uint32 len)
Definition: xloginsert.c:364
void log_newpage_range(Relation rel, ForkNumber forknum, BlockNumber startblk, BlockNumber endblk, bool page_std)
Definition: xloginsert.c:1270
void XLogResetInsertion(void)
Definition: xloginsert.c:222
XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std)
Definition: xloginsert.c:1237
void log_newpages(RelFileLocator *rlocator, ForkNumber forknum, int num_pages, BlockNumber *blknos, char **pages, bool page_std)
Definition: xloginsert.c:1175
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
Definition: xloginsert.c:242
void XLogBeginInsert(void)
Definition: xloginsert.c:149
XLogRecPtr log_newpage(RelFileLocator *rlocator, ForkNumber forknum, BlockNumber blkno, char *page, bool page_std)
Definition: xloginsert.c:1143
void XLogEnsureRecordSpace(int max_block_id, int ndatas)
Definition: xloginsert.c:175