Re: Fetching timeline during recovery

From: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: David Steele <david(at)pgmasters(dot)net>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Subject: Re: Fetching timeline during recovery
Date: 2019-07-23 21:01:43
Message-ID: 20190723230143.2e112c2e@firost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 23 Jul 2019 16:00:29 -0400
David Steele <david(at)pgmasters(dot)net> wrote:

> On 7/23/19 2:59 PM, Andrey Borodin wrote:
> >
> >> 23 июля 2019 г., в 21:05, Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-07-23 21:08:38 Re: make \d pg_toast.foo show its indices ; and, \d toast show its main table ; and \d relkind=I show its partitions
Previous Message Dave Cramer 2019-07-23 20:37:27 Re: Procedure support improvements