Re: why pg_walfile_name() cannot be executed during recovery?

From: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: why pg_walfile_name() cannot be executed during recovery?
Date: 2021-04-07 17:04:38
Message-ID: 20210407190438.14e2c7b7@firost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2 Apr 2021 08:22:09 -0400
Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Fri, Apr 2, 2021 at 4:23 AM SATYANARAYANA NARLAPURAM
> <satyanarlapuram(at)gmail(dot)com> wrote:
> > Why pg_walfile_name() can't be executed under recovery?
>
> I believe the issue is that the backend executing the function might
> not have an accurate idea about which TLI to use. But I don't
> understand why we can't find some solution to that problem.
>
> > What is the best way for me to get the current timeline and/or the file
> > being recovering on the standby using a postgres query? I know I can get it
> > via process title but don't want to go that route.
>
> pg_stat_wal_receiver has LSN and TLI information, but probably won't
> help except when WAL receiver is actually active.
> pg_last_wal_receive_lsn() and pg_last_wal_replay_lsn() will give the
> LSN at any point during recovery, but not the TLI. We might have some
> gaps in this area...

Yep, see previous discussion:
https://www.postgresql.org/message-id/flat/20190723180518.635ac554%40firost

The status by the time was to consider a new view eg. pg_stat_recovery, to
report various recovery stats.

But maybe the best place now would be to include it in the new pg_stat_wal view?

As I'm interesting with this feature as well, I volunteer to work on it as
author or reviewer.

Regards,

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-04-07 17:07:07 Re: multi-install PostgresNode fails with older postgres versions
Previous Message Alvaro Herrera 2021-04-07 16:51:55 Re: multi-install PostgresNode fails with older postgres versions