On Tue, 23 Jul 2019 16:00:29 -0400 David Steele <da...@pgmasters.net> wrote:
> On 7/23/19 2:59 PM, Andrey Borodin wrote: > > > >> 23 июля 2019 г., в 21:05, Jehan-Guillaume de Rorthais <j...@dalibo.com> > >> написал(а): > >> > >> Fetching the timeline from a standby could be useful in various situation. > >> Either for backup tools [1] or failover tools during some kind of election > >> process. > > That backup tool is reading timeline from pg_control_checkpoint(). And > > formats WAL file name itself when necessary. > > We do the same [1]. Thank you both for your comments. OK, so backup tools are fine with reading slightly outdated data from controldata file. Anyway, my use case is mostly about auto failover. During election, I currently have to force a checkpoint on standbys to get their real timeline from the controldata. However, the forced checkpoint could be very long[1] (considering auto failover). I need to be able to compare TL without all the burden of a CHECKPOINT just for this. As I wrote, my favorite solution would be a function returning BOTH current TL and LSN at the same time. I'll send a patch tomorrow to the list and I'll bikeshedding later depending on the feedback. In the meantime, previous patch might still be useful for some other purpose. Comments are welcomed. Thanks, [1] this exact use case is actually hiding behind this thread: https://www.postgresql.org/message-id/flat/CAEkBuzeno6ztiM1g4WdzKRJFgL8b2nfePNU%3Dq3sBiEZUm-D-sQ%40mail.gmail.com