Re: binary version of pg_current_wal_insert_lsn and pg_walfile_name functions

Поиск
Список
Период
Сортировка
От Ashutosh Sharma
Тема Re: binary version of pg_current_wal_insert_lsn and pg_walfile_name functions
Дата
Msg-id CAE9k0Pk_2_LvRPVRAT_U2nC=bu9fzQuxf=fwPDRugo6-DRz+gA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: binary version of pg_current_wal_insert_lsn and pg_walfile_name functions  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Ответы Re: binary version of pg_current_wal_insert_lsn and pg_walfile_name functions  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
On Thu, Sep 22, 2022 at 7:41 AM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Wed, Sep 21, 2022 at 9:53 PM Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
> >
> > Yeah, we can either add this functionality to pg_waldump or maybe add
> > a new binary itself that would return this information.
>
> IMV, a separate tool isn't the way, since pg_waldump already reads WAL
> files and decodes WAL records, what's proposed here can be an
> additional functionality of pg_waldump.
>
> It will be great if an initial patch is posted here.
>

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:

ashu@92893de650ed:~/pgsql$ pg_waldump -l -D ./data-dir
Latest LSN: 0/148A45F8
Latest WAL filename: 000000010000000000000014

How has it been coded?

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. From the control file, it gets information like redo
pointer and current timeline id. 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.

Please note that for compressed and .partial wal files this doesn't work.

--
With Regards,
Ashutosh Sharma.

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Reducing the WAL overhead of freezing in VACUUM by deduplicating per-tuple freeze plans
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Extending outfuncs support to utility statements