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

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, 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: 2022-04-22 14:15:14
Message-ID: CALj2ACXU2uuMgRbYKvWRMFuH4WBYyCqnCudRnbF0HD+nmzp9hw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Apr 9, 2022 at 10:21 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Sat, Apr 9, 2022 at 12:25 PM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> > Please excuse me if I'm not attentive enough. I've read this thread. And I could not find what is the problem that you are solving. What is the purpose of the WAL file name you want to obtain?
>
> Yeah, I'd also like to know this.

IMO, uses of pg_walfile_{name, name_offset} are plenty. Say, I have
LSNs (say, flush, insert, replayed or WAL receiver latest received)
and I would like to know the WAL file name and offset in an app
connecting to postgres or a control plane either for doing some
reporting or figuring out whether a WAL file exists given an LSN or
for some other reason. With these functions restricted when the server
is in recovery mode, the apps or control plane code can't use them and
they have to do if (!pg_is_in_recovery()) {select * from
pg_walfile_{name, name_offset}.

Am I missing any other important use-cases?

Regards,
Bharath Rupireddy.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-04-22 14:16:02 Re: Fix NULL pointer reference in _outPathTarget()
Previous Message Tom Lane 2022-04-22 14:14:23 Re: Dump/Restore of non-default PKs