On Thu, 2018-10-11 at 19:53 +0200, Laurenz Albe wrote: > Indeed, your sentence > > > if , for example, it recovered to "A" at "o1", then > > the switched WAL(in case of stop-then-recover) or .partial > > corresponding WAL(in case of promote) is the last WAL of the > > timeline1 > > seems to contradict your drawing, which has B after A on timeline 1.
Err... I mean "o1" is the end of timelien1, and the last WAL is the one "o1" was on just before recovering to "A". > Example: > Assume that timeline 1 reaches to 000000010000001500000030. > We recover to point A, which is in the middle of > 000000010000001500000020, > and there branch to timeline 2. > After some time, we decide to recover again, starting from a > checkpoint in 000000010000001500000010. > We want to recover to 2018-10-11 12:00:00. > > How can you know how many WAL segments there are on timeline 1, and > if > there is one that extends past 2018-10-11 12:00:00 or not? This is the exact problem I want to figure out. My approach is as you said, I will parse each archived WAL segment via `pg_xlogdump -r Transaction`, and try to find the first least earliest WAL against the specified time. This is a linear search, which has complexity of O(n). So if you want to recover to that point of time, how do you choose the timeline? --- Magodo