pg_waldump -R filter

From: Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_waldump -R filter
Date: 2025-06-23 02:58:56
Message-ID: CAPsk3_BW5J8hDz99ymbLHJbKsA+3zGv0tnNN9=Vo+D3tE8qKmQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers~

Recently when I was debugging with pg_waldump, I just want to filter out
all the records about a specific relfilelocator, so I used -R T/D/R.
I do get records like FPI, but not SMGR_CREATE / SMGR_TRUNCATE. Quick
search of code tells me that pg_waldump would only keep records with
block ref, while some WAL type does not have any block ref.

$ pg_waldump -R 1663/5/16398 000000010000000000000001
rmgr: XLOG len (rec/tot): 62/ 210, tx: 757, lsn:
0/40C20178, prev 0/40C20130, desc: FPI , blkref #0: rel 1663/5/16398
blk 0 FPW, blkref #1: rel 1663/5/16398 blk 1 FPW

$ pg_waldump 000000010000000000000001 | grep 16398
rmgr: Storage len (rec/tot): 42/ 42, tx: 0, lsn:
0/40C1FBD0, prev 0/40C1FBA8, desc: CREATE base/5/16398
rmgr: Standby len (rec/tot): 42/ 42, tx: 757, lsn:
0/40C1FC38, prev 0/40C1FC00, desc: LOCK xid 757 db 5 rel 16398
rmgr: XLOG len (rec/tot): 62/ 210, tx: 757, lsn:
0/40C20178, prev 0/40C20130, desc: FPI , blkref #0: rel 1663/5/16398
blk 0 FPW, blkref #1: rel 1663/5/16398 blk 1 FPW
rmgr: Transaction len (rec/tot): 274/ 274, tx: 757, lsn:
0/40C203D0, prev 0/40C20310, desc: COMMIT 2025-06-22 04:25:41.953683
UTC; ...

It seems that -R is just a helper for -B. But since it can be used without
-B, would it be better for pg_waldump to keep all WAL records about a
rlocator no matter it has a block ref? It might be helpful for inspecting
the whole life cycle of a rlocator.

--

Regards,
Jingtang

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-06-23 03:26:21 Re: Minor patch; missing comment update in worker.c
Previous Message Hayato Kuroda (Fujitsu) 2025-06-23 02:52:16 Minor patch; missing comment update in worker.c