From 8723da10f14a7811875b7628344edea2d207b982 Mon Sep 17 00:00:00 2001
From: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Date: Fri, 4 Sep 2026 13:04:54 +0530
Subject: [PATCH v1] Fix WAL block image length diagnostic

When neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED is set,
DecodeXLogRecord() checks that bimg_len equals BLCKSZ. However, the
associated error message reports data_len, which describes optional
resource manager data and can be unrelated to the block image.

Report bimg_len instead, matching the check and the diagnostic.

Backpatch-through: 14
---
 src/backend/access/transam/xlogreader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 4bfe8607f4e..7db7c273b0c 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -1929,7 +1929,7 @@ DecodeXLogRecord(XLogReaderState *state,
 				{
 					report_invalid_record(state,
 										  "neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %d at %X/%08X",
-										  blk->data_len,
+										  blk->bimg_len,
 										  LSN_FORMAT_ARGS(state->ReadRecPtr));
 					goto err;
 				}

base-commit: 534db08f972852b77ea5e96e77d5fe45f3d8df93
-- 
2.34.1

