> On 9 Apr 2022, at 18:30, Bharath Rupireddy
> <bharath.rupireddyforpostg...@gmail.com> wrote:
>
> Using insert tli when not in recovery and using tli of the last WAL
> replayed record in crash/archive/standby recovery, seems a reasonable
> choice to me.
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?
pg_walfile_name() - is a formatting function. With TLI as an hidden argument.
If we want it to work on Standby we should just convert it to pure formatting
function without access the the DB state, pass TLI as an argument.
Making implicit TLI computation with certain expectations is not a good idea
IMV.
pg_walfile_name() could just read .history file, determine which TLI contains
given LSN and format the name. And still there's a tricky segments during TLI
switch.
Either way we can rename the function to
pg_walfile_name_as_if_on_timeline_of_last_wal_replayed().
Thanks!
Best regards, Andrey Borodin.