Skip to content
Snippets Groups Projects
Commit 2c107bf7 authored by Michael Paquier's avatar Michael Paquier
Browse files

pg_wal_blocks: Fix compilation with v11

The WAL segment size is something that can be customized at initialization
time in v11, and was previously decided at compilation time. This makes the
module able to work with a default segment size of 16MB. In order to
support more sizes, the segment size needs to be passed as an argument.
parent 6f9e3072
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -24,6 +24,7 @@ const char *progname;
/* Global parameters */
static bool verbose = false;
static char *full_path = NULL;
static uint32 WalSegSz = DEFAULT_XLOG_SEG_SIZE; /* should be settable */
 
/* Data regarding input WAL to parse */
static XLogSegNo segno = 0;
Loading
Loading
@@ -94,7 +95,7 @@ XLogReadPageBlock(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
(XLogReadBlockPrivate *) xlogreader->private_data;
uint32 targetPageOff;
 
targetPageOff = targetPagePtr % XLogSegSize;
targetPageOff = targetPagePtr % WalSegSz;
 
if (xlogreadfd < 0)
{
Loading
Loading
@@ -181,8 +182,8 @@ do_wal_parsing(void)
private.full_path = full_path;
 
/* Set the first record to look at */
XLogSegNoOffsetToRecPtr(segno, 0, first_record);
xlogreader = XLogReaderAllocate(XLogReadPageBlock, &private);
XLogSegNoOffsetToRecPtr(segno, 0, first_record, WalSegSz);
xlogreader = XLogReaderAllocate(WalSegSz, XLogReadPageBlock, &private);
first_record = XLogFindNextRecord(xlogreader, first_record);
 
/* Loop through all the records */
Loading
Loading
@@ -285,7 +286,7 @@ main(int argc, char **argv)
close(fd);
 
/* parse timeline and segment number from file name */
XLogFromFileName(fname, &timeline_id, &segno);
XLogFromFileName(fname, &timeline_id, &segno, WalSegSz);
}
 
if (full_path == NULL)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment