Inconsistent LSN format in pg_waldump output

From: Japin Li <japinli(at)hotmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Inconsistent LSN format in pg_waldump output
Date: 2025-07-01 09:45:55
Message-ID: ME0P300MB0445CA53CA0E4B8C1879AF84B641A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi, all

I've noticed an inconsistency in the LSN format printed by pg_waldump,
specifically concerning the lsn: and prev fields in the output.

$ pg_waldump /tmp/pgdata02/pg_wal/00000001000000000000000A 2>/dev/null |grep 'AB10260'
rmgr: XLOG len (rec/tot): 114/ 114, tx: 0, lsn: 0/0AB10260, prev 0/0AB10228, desc: CHECKPOINT_SHUTDOWN redo 0/AB10260; ...
^ ^

In the output above, the LSN 0/AB10260 and 0/0AB10260 refer to the same logical
LSN, but are presented with a different number of leading zeros in the lower
32-bit part.

Upon further investigation, I grepped the source code for the format specifier
used:

$ grep '%X\/%08X' -rn src/
src/bin/pg_waldump/pg_waldump.c:558: printf("rmgr: %-11s len (rec/tot): %6u/%6u, tx: %10u, lsn: %X/%08X, prev %X/%08X, ",

This inconsistency, while minor, could be confusing when cross-referencing
LSNs within pg_waldump's own output or when parsing it programmatically.

--
Regards,
Japin Li

Attachment Content-Type Size
v1-0001-Fix-inconsistent-LSN-format-in-pg_waldump.patch text/x-diff 912 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2025-07-01 09:50:14 Re: Logical Replication of sequences
Previous Message Arseniy Mukhin 2025-07-01 09:35:29 Re: Cross-type index comparison support in contrib/btree_gin