public inbox for [email protected]  
help / color / mirror / Atom feed
From: Justin Pryzby <[email protected]>
Subject: [PATCH] xlog_block_info: show compression method
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--





view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH] xlog_block_info: show compression method
  In-Reply-To: <no-message-id-1858519@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox