Subject: [PATCH] xlog_block_info: show compression method

From: Justin Pryzby <[email-masked]>
Date: Sat, 19 Feb 2022 11:35:53 -0600

---
 src/backend/access/transam/xlogrecovery.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 4ad145dd167..75a72b47f78 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -2238,7 +2238,20 @@ xlog_block_info(StringInfo buf, XLogReaderState *record)
 							 rlocator.relNumber,
 							 blk);
 		if (XLogRecHasBlockImage(record, block_id))
-			appendStringInfoString(buf, " FPW");
+		{
+			if (!BKPIMAGE_COMPRESSED(record->blocks[block_id].bimg_info))
+				appendStringInfoString(buf, " FPW");
+			else
+			{
+				uint8 info = record->blocks[block_id].bimg_info;
+				char *compression =
+					(BKPIMAGE_COMPRESS_PGLZ & info) ? "pglz" :
+					(BKPIMAGE_COMPRESS_LZ4 & info) ? "lz4" :
+					(BKPIMAGE_COMPRESS_ZSTD & info) ? "zstd" : "unknown";
+
+				appendStringInfo(buf, " FPW, compression method: %s", compression);
+			}
+		}
 	}
 }
 
-- 
2.17.1

--um2V5WpqCyd73IVb--