From 35777aa91429c5858a740afc75b75f290c5d304e Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Tue, 13 Feb 2024 06:12:22 +0000 Subject: [PATCH v1] Do away with zero-padding assumption before WALRead --- src/backend/access/transam/xlogutils.c | 7 +------ src/backend/postmaster/walsummarizer.c | 7 +------ src/backend/replication/walsender.c | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index 945f1f790d..ad93035d50 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -1007,12 +1007,7 @@ read_local_xlog_page_guts(XLogReaderState *state, XLogRecPtr targetPagePtr, count = read_upto - targetPagePtr; } - /* - * Even though we just determined how much of the page can be validly read - * as 'count', read the whole page anyway. It's guaranteed to be - * zero-padded up to the page boundary if it's incomplete. - */ - if (!WALRead(state, cur_page, targetPagePtr, XLOG_BLCKSZ, tli, + if (!WALRead(state, cur_page, targetPagePtr, count, tli, &errinfo)) WALReadRaiseError(&errinfo); diff --git a/src/backend/postmaster/walsummarizer.c b/src/backend/postmaster/walsummarizer.c index 9b883c21ca..afed15a257 100644 --- a/src/backend/postmaster/walsummarizer.c +++ b/src/backend/postmaster/walsummarizer.c @@ -1318,12 +1318,7 @@ summarizer_read_local_xlog_page(XLogReaderState *state, } } - /* - * Even though we just determined how much of the page can be validly read - * as 'count', read the whole page anyway. It's guaranteed to be - * zero-padded up to the page boundary if it's incomplete. - */ - if (!WALRead(state, cur_page, targetPagePtr, XLOG_BLCKSZ, + if (!WALRead(state, cur_page, targetPagePtr, count, private_data->tli, &errinfo)) WALReadRaiseError(&errinfo); diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 146826d5db..945084eb01 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -1099,7 +1099,7 @@ logical_read_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int req if (!WALRead(state, cur_page, targetPagePtr, - XLOG_BLCKSZ, + count, currTLI, /* Pass the current TLI because only * WalSndSegmentOpen controls whether new TLI * is needed. */ -- 2.34.1