27.08.2026, 16:17, "Andrey Borodin" <x4mmm@yandex-team.ru>:
> 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";
 
Hi, Andrey!
 
Thank you for the review. You are right, there is a race.
 
In v2 i added suggested query to wait timeline_2_lsn. This will help
to avoid promotion before timeline2 is applied.
 
Thank you!

Best regards, Stepan Filippov.