[HACKERS] Reading timeline from pg_control on replication slave - Mailing list pgsql-hackers

From Andrey Borodin
Subject [HACKERS] Reading timeline from pg_control on replication slave
Date
Msg-id BF2AD4A8-E7F5-486F-92C8-A6959040DEB6@yandex-team.ru
Whole thread Raw
Responses Re: [HACKERS] Reading timeline from pg_control on replication slave
List pgsql-hackers
Hi, hackers!

I'm working on backups from replication salve in WAL-G [0]
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[1] that, if on replica, reads timeline from pg_control file and formats WAL file name as is it was
producesby pg_wal_filename(lsn). 

Are there any serious dangers? Obviously, this hack is not crisp and clear. Is the risk of reading stale timeline
reallya problem? By reading TimeLineId from file I'm fighting those precautions in pg_walfile_name(..) which were
implementedfor a reason, I guess.  

Thanks for reading this. I'll be happy to hear any comments on the matter.

[0] https://github.com/wal-g/wal-g/pull/32
[1] https://github.com/wal-g/wal-g/pull/32/files#diff-455316c14fb04c9f9748a0798ad151d9R158

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Re: Is anything preventing us from allowing write toforeign tables from standby?
Next
From: Rajkumar Raghuwanshi
Date:
Subject: Re: [HACKERS] path toward faster partition pruning