On 28 October 2017 at 06:09, Michael Paquier <michael.paqu...@gmail.com> wrote: > On Fri, Oct 27, 2017 at 1:04 AM, Andrey Borodin <x4...@yandex-team.ru> wrote: >> I'm working on backups from replication salve in WAL-G  >> Backups used to use result of pg_walfile_name(pg_start_backup(...)). Call to >> pg_start_backup() works nice, but "pg_walfile_name() cannot be executed >> during recovery." >> This function has LSN as argument and reads TimeLineId from global state. >> So I made a function that, if on replica, reads timeline from pg_control >> file and formats WAL file name as is it was produces by pg_wal_filename(lsn). > > ThisTimeLineID is not something you can rely on for standby backends > as it is not set during recovery.
That's not much of a concern really, you just have to ensure you call GetXLogReplayRecPtr and set ThisTimeLineID. (I'd quite like ThisTimeLineID to go away as a global. It's messy and confusing, and I'd much rather it be fetched when needed). However, that doesn't negate the rest of the issues you raised. -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers