From d12cd064b0d5d81d254516ab18f9c91bcc21569c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 9 Dec 2024 16:35:23 +0100 Subject: [PATCH 3/3] Add more use of Page/PageData rather than char * --- src/backend/access/transam/xloginsert.c | 16 ++++++++-------- src/include/access/xloginsert.h | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c index f92d0626082..1151b68470e 100644 --- a/src/backend/access/transam/xloginsert.c +++ b/src/backend/access/transam/xloginsert.c @@ -72,7 +72,7 @@ typedef struct RelFileLocator rlocator; /* identifies the relation and block */ ForkNumber forkno; BlockNumber block; - const char *page; /* page content */ + const PageData *page; /* page content */ uint32 rdata_len; /* total length of data in rdata chain */ XLogRecData *rdata_head; /* head of the chain of data registered with * this block */ @@ -138,8 +138,8 @@ static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info, XLogRecPtr RedoRecPtr, bool doPageWrites, XLogRecPtr *fpw_lsn, int *num_fpi, bool *topxid_included); -static bool XLogCompressBackupBlock(const char *page, uint16 hole_offset, - uint16 hole_length, char *dest, uint16 *dlen); +static bool XLogCompressBackupBlock(const PageData *page, uint16 hole_offset, + uint16 hole_length, void *dest, uint16 *dlen); /* * Begin constructing a WAL record. This must be called before the @@ -307,7 +307,7 @@ XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags) */ void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator, ForkNumber forknum, - BlockNumber blknum, const char *page, uint8 flags) + BlockNumber blknum, const PageData *page, uint8 flags) { registered_buffer *regbuf; @@ -648,7 +648,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, if (include_image) { - const char *page = regbuf->page; + const PageData *page = regbuf->page; uint16 compressed_len = 0; /* @@ -941,13 +941,13 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, * the length of compressed block image. */ static bool -XLogCompressBackupBlock(const char *page, uint16 hole_offset, uint16 hole_length, - char *dest, uint16 *dlen) +XLogCompressBackupBlock(const PageData *page, uint16 hole_offset, uint16 hole_length, + void *dest, uint16 *dlen) { int32 orig_len = BLCKSZ - hole_length; int32 len = -1; int32 extra_bytes = 0; - const char *source; + const void *source; PGAlignedBlock tmp; if (hole_length != 0) diff --git a/src/include/access/xloginsert.h b/src/include/access/xloginsert.h index 652f7bc9bd1..09cf07992ca 100644 --- a/src/include/access/xloginsert.h +++ b/src/include/access/xloginsert.h @@ -15,6 +15,7 @@ #include "access/xlogdefs.h" #include "storage/block.h" #include "storage/buf.h" +#include "storage/bufpage.h" #include "storage/relfilelocator.h" #include "utils/relcache.h" @@ -47,16 +48,16 @@ extern void XLogEnsureRecordSpace(int max_block_id, int ndatas); extern void XLogRegisterData(const char *data, uint32 len); extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags); extern void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator, - ForkNumber forknum, BlockNumber blknum, const char *page, + ForkNumber forknum, BlockNumber blknum, const PageData *page, uint8 flags); extern void XLogRegisterBufData(uint8 block_id, const char *data, uint32 len); extern void XLogResetInsertion(void); extern bool XLogCheckBufferNeedsBackup(Buffer buffer); extern XLogRecPtr log_newpage(RelFileLocator *rlocator, ForkNumber forknum, - BlockNumber blkno, char *page, bool page_std); + BlockNumber blkno, Page page, bool page_std); extern void log_newpages(RelFileLocator *rlocator, ForkNumber forknum, int num_pages, - BlockNumber *blknos, char **pages, bool page_std); + BlockNumber *blknos, Page *pages, bool page_std); extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std); extern void log_newpage_range(Relation rel, ForkNumber forknum, BlockNumber startblk, BlockNumber endblk, bool page_std); -- 2.47.1