aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlogutils.c
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2024-02-16 11:09:11 -0800
committerJeff Davis <jdavis@postgresql.org>2024-02-16 11:09:11 -0800
commit73f0a1326608ac3a7d390706fdeec59fe4dc42c0 (patch)
tree458ae7eefbdeb90798ee8389d1331b141df0fd9b /src/backend/access/transam/xlogutils.c
parent9ecbf54075a91ed155cc779fcc1870de0fff5fef (diff)
downloadpostgresql-73f0a1326608ac3a7d390706fdeec59fe4dc42c0.tar.gz
postgresql-73f0a1326608ac3a7d390706fdeec59fe4dc42c0.zip
Pass correct count to WALRead().
Previously, some callers requested XLOG_BLCKSZ bytes unconditionally. While this did not cause a problem, because the extra bytes are ignored, it's confusing and makes it harder to add safety checks. Additionally, the comment about zero padding was incorrect. With this commit, all callers request the number of bytes they actually need. Author: Bharath Rupireddy Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/CALj2ACWBRFac2TingD3PE3w2EBHXUHY3=AEEZPJmqhpEOBGExg@mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/xlogutils.c')
-rw-r--r--src/backend/access/transam/xlogutils.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index 945f1f790d5..ad93035d508 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);