how to identify the timeline of specified recovery_target_time whendo multiple PITR - Mailing list pgsql-general

From magodo
Subject how to identify the timeline of specified recovery_target_time whendo multiple PITR
Date
Msg-id 29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com
Whole thread Raw
Responses Re: how to identify the timeline of specified recovery_target_timewhen do multiple PITR  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
I read the document about recovery configuration, it says:

   recovery_target_timeline (string)

   ...

   Other than that you only need to set this parameter in complex re-
   recovery situations, where you need to return to a state that itself
   was reached after a point-in-time recovery. See Section 25.3.5 for
   discussion.

   ...

Andin section 25.3.5 it says:

   ...

   If you wish to recover into some child timeline (that is, you want
   to return to some state that was itself generated after a recovery
   attempt), you need to specify the target timeline ID in
   recovery.conf.

   ...

Therefore, suppose I am going to recover to a point of some child
timeline, to identify the point, I have to specify either
recovery_target_name or recovery_target_time, and also specify the
recovery_target_timeline.

It is more like a tuple like (recovery_target_time,
recovery_target_timeline), that specify a real point among all history
branches. Am I understand this correctly?

If yes, what I want to ask is that, though the timeline is increasing
between different recovery, but each timestamp corresponds to a
timeline ID, one by one. So if I get a recovery_target_time, why should
I still specify the recovery_target_timeline? 

Suppose following illustration:

         A     B
BASE-----+-----+------o1 (recover to A)                              1
         |     |           C
         +.....|.......----+---o2 (regret, recover to B)             2
               |           |    
               +...........|..------o3 (regret again, recover to C)  3
                           | 
                           +........----                             4


Legend:

   BASE: basebackup
   A-Z: recovery point
   ---: active wal histroy (continuous among branches)
   ...: inactive wal history
   oN: point to do PITR

If am at "o3", and I want to recover to "C", if I don't specify
timeline ID, then i will ends up with state as "o1". Only if I specify
timeline ID as "2", then I can get the state as I expect (as
illustrated). 

Why not just recover along the history from timeline 1 to the timeline
specified by recovery target? The only reason I can imagine is that
there is a chance that there are two active timeline at same point, but
what is the use case of that(if it exists)?




pgsql-general by date:

Previous
From: Harry B
Date:
Subject: Postgres 11, partitioning with a custom hash function
Next
From: Dean Rasheed
Date:
Subject: Re: Postgres trigger side-effect is occurring out of order withrow-level security select policy