Re: pg_walinspect: add functions to locate and list WAL by time and LSN

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_walinspect: add functions to locate and list WAL by time and LSN
Date: 2026-12-04 04:21:36
Message-ID: axI_0OJXFTPlsRiF@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 24, 2026 at 02:38:53PM +0800, Chao Li wrote:
> In the case the DBAs described to me, they may only remember that
> the incident happened around 1am. That’s why the patch lets them
> specify before and after intervals around that time. The operation
> could have been a DELETE, a TRUNCATE, an ALTER TABLE, or something
> else. The idea is to give them a narrower LSN range so they can dig
> into the WAL in whatever ways they like, even if they don’t yet know
> which operation to look for.

(Bharath has mentioned me this thread.)

I was looking at the proposed patch set, and I am convinced that we do
not need pg_get_wal_location_at_time() and complicate pg_walinspect
with that, due to the reason that it is already possible to achieve
the same thing by looking at the record description and apply a regex
with a substring to extract the information you want. Bonus points on
the fact that GetXLogRecordTimestamp() would most likely rot as it
relies on the RMGR IDs and a set of sub-record types. Your patch also
discards custom RMGRs. A loaded library holding a custom RMGR is able
to work.

pg_get_wal_files(), which wants to get a list of WAL segments based on
a set of start and end LSNs is also something that one can achieve on
a per-SQL basis with only the existing functions. One advantage that
I may see in your proposal is that we are currently weak in terms of
functions that can access a history file for a given timeline, parse
it, and show its output as a set of rows with multiple attributes.
Whether this is something that should be part of pg_walinspect is a
different argument. It is also possible to do that with a read of a
history file with pg_read_file(), but you could also have a dedicated
function revoked from public that is able to do this job based on a
TLI number given in input.

As a whole, I'm -1 regarding these two proposals, and I think that we
should reject this patch.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-12-04 04:48:48 RE: Table AM callback for logical decoding support (REPACK CONCURRENTLY)
Previous Message shihao zhong 2026-12-04 04:06:11 Re: [PATCH] pageinspect: validate line pointers before using them