On Thu, Sep 22, 2022 at 10:25 PM Ashutosh Sharma <ashu.coe...@gmail.com> wrote: > > PFA that enhances pg_waldump to show the latest LSN and the > corresponding WAL file when the -l or --lastLSN option is passed an > argument to pg_waldump. Below is an example:
Thanks for the patch. I have some quick thoughts about it. > When the user passes the '-l' command line option along with the data > directory path to pg_waldump, it reads the control file from the data > directory. I don't think we need a new option for data directory -D. pg_waldump's option 'p' can be used, please see the comments around identify_target_directory(). > From the control file, it gets information like redo > pointer and current timeline id. Is there any reason for not using get_control_file() from src/common/controldata_utils.c, but defining the exact same function in pg_waldump.c? > The redo pointer is considered to be > the start pointer from where the pg_waldump starts reading wal data > until end-of-wal to find the last LSN. For details please check the > attached patch. Making it dependent on the controlfile limits the usability of this feature. Imagine, using this feature on an archive location or pg_receivewal target directory where there are WAL files but no controlfile. I think we can choose the appropriate combinations of existing pg_waldump options, for instance, let users enter the start WAL segment via startseg and/or start LSN via --start and the new option for end WAL segment and end LSN. > Please note that for compressed and .partial wal files this doesn't work. Looking forward to the above capability because it expands the usability of this feature. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com