codekingpro/portable-devtools
116k
1/*2 * xloginsert.h3 *4 * Functions for generating WAL records5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * src/include/access/xloginsert.h10 */11#ifndef XLOGINSERT_H12#define XLOGINSERT_H13 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 to23 * register more than XLR_NORMAL_MAX_BLOCK_ID block references or have more24 * than XLR_NORMAL_RDATAS data chunks in a single WAL record, you must call25 * XLogEnsureRecordSpace() first to allocate more working memory.26 */27#define XLR_NORMAL_MAX_BLOCK_ID 428#define XLR_NORMAL_RDATAS 2029 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 at34 * replay (implies NO_IMAGE) */35#define REGBUF_STANDARD 0x08 /* page follows "standard" page layout,36 * (data between pd_lower and pd_upper37 * will be skipped) */38#define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image39 * is taken */40 41/* prototypes for public functions in xloginsert.c: */42extern void XLogBeginInsert(void);43extern void XLogSetRecordFlags(uint8 flags);44extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info);45extern void XLogEnsureRecordSpace(int max_block_id, int ndatas);46extern void XLogRegisterData(char *data, uint32 len);47extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags);48extern void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator,49 ForkNumber forknum, BlockNumber blknum, char *page,50 uint8 flags);51extern void XLogRegisterBufData(uint8 block_id, char *data, uint32 len);52extern void XLogResetInsertion(void);53extern bool XLogCheckBufferNeedsBackup(Buffer buffer);54 55extern XLogRecPtr log_newpage(RelFileLocator *rlocator, ForkNumber forknum,56 BlockNumber blkno, char *page, bool page_std);57extern void log_newpages(RelFileLocator *rlocator, ForkNumber forknum, int num_pages,58 BlockNumber *blknos, char **pages, bool page_std);59extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std);60extern void log_newpage_range(Relation rel, ForkNumber forknum,61 BlockNumber startblk, BlockNumber endblk, bool page_std);62extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);63 64extern void InitXLogInsert(void);65 66#endif /* XLOGINSERT_H */67 