Re: Inconsistent LSN format in pg_waldump output

From: Japin Li <japinli(at)hotmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Inconsistent LSN format in pg_waldump output
Date: 2025-07-03 05:21:25
Message-ID: ME0P300MB0445D38F576B1BB77E4C35B0B643A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 03 Jul 2025 at 10:16, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Thu, Jul 3, 2025 at 7:32 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>>
>> On Wed, Jul 02, 2025 at 08:57:45PM +0200, Alvaro Herrera wrote:
>> > I think a tool would have to be severely miswritten in order to become
>> > broken from this change. Our own code to scan LSNs is to use
>> > scanf('%X/%X') which should work just fine with and without the leading
>> > zeroes. I honestly don't see anybody coding this in any different way
>> > that could not cope with the leading zeroes :-)
>
> I had concerns regarding scenarios where users or tools
> programmatically search for LSNs or perform string comparisons without
> proper parsing, as initially raised by Japin Li. For instance, if a
> newer version of the server records an LSN as '0/0AB10228' in the
> server log, users attempting to search for this LSN won't find matches
> in logs generated by older server versions. While such differences
> might be acceptable across major version upgrades, I'm uncertain
> whether this inconsistency is appropriate between minor versions.
>
>> Yep. If you do not want this new policy to be forgotten by new paths,
>> I'd suggested to standarize that with something like that, close to
>> the existing LSN_FORMAT_ARGS():
>> #define LSN_FORMAT "%X/%08X"
>
> +1
>

Thanks everyone for reviewing this patch. Please find v3 attached.

--
Regards,
Japin Li

Attachment Content-Type Size
v3-0001-Standardize-LSN-formatting-by-zero-padding.patch text/x-diff 174.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-07-03 05:26:56 Re: Conflict detection for update_deleted in logical replication
Previous Message Amit Kapila 2025-07-03 05:13:24 Re: Conflict detection for update_deleted in logical replication