Hi Stepan, Andrey,

I agree that lastRecTLI is the right parent here.  It is already used as
PrevTimeLineID for the end-of-recovery record.  endOfLogTLI would not be
a substitute: in the 028 scenario it is the timeline in the segment
name, not the timeline of the last replayed record.

It seems to me that 002_archiving.pl has a race.  Generating and
archiving WAL on timeline 2 does not guarantee that standby2 replays it
before promotion.  It can still be promoted while lastRecTLI is 1, so
the test would not prove that the restored timeline 2 history was used.
I think it needs to wait for the recorded timeline_2_lsn before calling
promote(), for example:

    $caughtup_query =
      "SELECT '$timeline_2_lsn'::pg_lsn <= pg_last_wal_replay_lsn()";
    $node_standby2->poll_query_until('postgres', $caughtup_query)
      or die "Timed out while waiting for standby2 to reach timeline 2";

Thank you!


Best regards, Andrey Borodin.



Reply via email to