Display is_prev_bucket_same_wrt of xl_hash_squeeze_page
Hi hackers!
While doing some xlog-related task at my job I noticed that pg_waldump
utility does not display `is_prev_bucket_same_wrt` of
xl_hash_squeeze_page record. I had to patch pg_waldump to fix the
issue, because I use pg_waldump output of vanilla pg to cross-check my
patches (in our closed-source pg-related project).
PFA fixing issue.
--
Best regards,
Kirill Reshke
Attachments:
v1-0001-Display-is_prev_bucket_same_wrt-of-xl_hash_squeez.patchapplication/octet-stream; name=v1-0001-Display-is_prev_bucket_same_wrt-of-xl_hash_squeez.patchDownload
From 7dd5906fdae15c60e82369666b2c8b22c9405269 Mon Sep 17 00:00:00 2001
From: reshke <reshke@double.cloud>
Date: Wed, 10 Sep 2025 12:23:11 +0000
Subject: [PATCH v1] Display is_prev_bucket_same_wrt of xl_hash_squeeze_page
wal record field
---
src/backend/access/rmgrdesc/hashdesc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/backend/access/rmgrdesc/hashdesc.c b/src/backend/access/rmgrdesc/hashdesc.c
index 75f43a91520..ed22b5c7aa3 100644
--- a/src/backend/access/rmgrdesc/hashdesc.c
+++ b/src/backend/access/rmgrdesc/hashdesc.c
@@ -85,11 +85,12 @@ hash_desc(StringInfo buf, XLogReaderState *record)
{
xl_hash_squeeze_page *xlrec = (xl_hash_squeeze_page *) rec;
- appendStringInfo(buf, "prevblkno %u, nextblkno %u, ntups %d, is_primary %c",
+ appendStringInfo(buf, "prevblkno %u, nextblkno %u, ntups %d, is_primary %c, is_previous %c",
xlrec->prevblkno,
xlrec->nextblkno,
xlrec->ntups,
- xlrec->is_prim_bucket_same_wrt ? 'T' : 'F');
+ xlrec->is_prim_bucket_same_wrt ? 'T' : 'F',
+ xlrec->is_prev_bucket_same_wrt ? 'T' : 'F');
break;
}
case XLOG_HASH_DELETE:
--
2.43.0
On Wed, Sep 10, 2025 at 06:28:10PM +0500, Kirill Reshke wrote:
While doing some xlog-related task at my job I noticed that pg_waldump
utility does not display `is_prev_bucket_same_wrt` of
xl_hash_squeeze_page record. I had to patch pg_waldump to fix the
issue, because I use pg_waldump output of vanilla pg to cross-check my
patches (in our closed-source pg-related project).
Good idea.
We are still missing the offsets in xl_hash_vacuum_one_page, which
would lead to a longer output, with perhaps less value in in.
How about old_bucket_flag and new_bucket_flag in
xl_hash_split_allocate_page, as well as procid in
xl_hash_init_meta_page? While we are looking at this area, we may as
well close the gap in the output produced.
--
Michael
HI, thanks for looking into this.
On Thu, 11 Sept 2025 at 05:54, Michael Paquier <michael@paquier.xyz> wrote:
We are still missing the offsets in xl_hash_vacuum_one_page, which
would lead to a longer output, with perhaps less value in in.
Yes. I guess we might want to implement this to keep things in sync:
we display dead/redirected tuple offsets in PRUNE VACUUM SCAN output
already, so maybe just display here too, this is also vacuum.
How about old_bucket_flag and new_bucket_flag in
xl_hash_split_allocate_page, as well as procid in
xl_hash_init_meta_page? While we are looking at this area, we may as
well close the gap in the output produced.
Sure
PFA v2.
--
Best regards,
Kirill Reshke
Attachments:
v2-0001-Display-more-fields-of-xl_hash-wal-records.patchapplication/octet-stream; name=v2-0001-Display-more-fields-of-xl_hash-wal-records.patchDownload
From 92fba8f16a79243a76031a12484961ca27f23217 Mon Sep 17 00:00:00 2001
From: reshke <reshke@double.cloud>
Date: Wed, 10 Sep 2025 12:23:11 +0000
Subject: [PATCH v2] Display more fields of xl_hash* wal records
Includes:
* Display is_prev_bucket_same_wrt of xl_hash_squeeze_page record
* Display old_bucket_flag & new_bucket_flag in
xl_hash_split_allocate_page record
* Display procid of xl_hash_init_meta_page record
---
src/backend/access/rmgrdesc/hashdesc.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/backend/access/rmgrdesc/hashdesc.c b/src/backend/access/rmgrdesc/hashdesc.c
index 75f43a91520..2ea90b15d62 100644
--- a/src/backend/access/rmgrdesc/hashdesc.c
+++ b/src/backend/access/rmgrdesc/hashdesc.c
@@ -28,8 +28,8 @@ hash_desc(StringInfo buf, XLogReaderState *record)
{
xl_hash_init_meta_page *xlrec = (xl_hash_init_meta_page *) rec;
- appendStringInfo(buf, "num_tuples %g, fillfactor %d",
- xlrec->num_tuples, xlrec->ffactor);
+ appendStringInfo(buf, "num_tuples %g, procid %u, fillfactor %d",
+ xlrec->num_tuples, xlrec->procid, xlrec->ffactor);
break;
}
case XLOG_HASH_INIT_BITMAP_PAGE:
@@ -58,8 +58,9 @@ hash_desc(StringInfo buf, XLogReaderState *record)
{
xl_hash_split_allocate_page *xlrec = (xl_hash_split_allocate_page *) rec;
- appendStringInfo(buf, "new_bucket %u, meta_page_masks_updated %c, issplitpoint_changed %c",
+ appendStringInfo(buf, "new_bucket %u, old_bucket_flag %u, new_bucket_flag %u, meta_page_masks_updated %c, issplitpoint_changed %c",
xlrec->new_bucket,
+ xlrec->old_bucket_flag, xlrec->new_bucket_flag,
(xlrec->flags & XLH_SPLIT_META_UPDATE_MASKS) ? 'T' : 'F',
(xlrec->flags & XLH_SPLIT_META_UPDATE_SPLITPOINT) ? 'T' : 'F');
break;
@@ -85,11 +86,12 @@ hash_desc(StringInfo buf, XLogReaderState *record)
{
xl_hash_squeeze_page *xlrec = (xl_hash_squeeze_page *) rec;
- appendStringInfo(buf, "prevblkno %u, nextblkno %u, ntups %d, is_primary %c",
+ appendStringInfo(buf, "prevblkno %u, nextblkno %u, ntups %d, is_primary %c, is_previous %c",
xlrec->prevblkno,
xlrec->nextblkno,
xlrec->ntups,
- xlrec->is_prim_bucket_same_wrt ? 'T' : 'F');
+ xlrec->is_prim_bucket_same_wrt ? 'T' : 'F',
+ xlrec->is_prev_bucket_same_wrt ? 'T' : 'F');
break;
}
case XLOG_HASH_DELETE:
--
2.43.0