On Mon, Sep 19, 2022 at 07:26:57PM +0530, Bharath Rupireddy wrote: > We have a bunch of messages [1] that have an offset, but not LSN in > the error message. Firstly, is there an easiest way to figure out LSN > from offset reported in the error messages? If not, is adding LSN to > these messages along with offset a good idea? Of course, we can't just > convert offset to LSN using XLogSegNoOffsetToRecPtr() and report, but > something meaningful like reporting the LSN of the page that we are > reading-in or writing-out etc.
It seems like you want the opposite of pg_walfile_name_offset(). Perhaps we could add a function like pg_walfile_offset_lsn() that accepts a WAL file name and byte offset and returns the LSN. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com