Re: [PATCH] Fix timeline history after recovery stops on an ancestor

From: Филиппов Степан <stepan(dot)filippov(at)yandex(dot)ru>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "heikki(dot)linnakangas(at)iki(dot)fi" <heikki(dot)linnakangas(at)iki(dot)fi>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: [PATCH] Fix timeline history after recovery stops on an ancestor
Date: 2026-09-07 09:36:14
Message-ID: 643911788772165@mail.yandex.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

<div> </div><div> </div><div>27.08.2026, 16:17, "Andrey Borodin" &lt;x4mmm(at)yandex-team(dot)ru&gt;:</div><div>&gt; It seems to me that 002_archiving.pl has a race. Generating and<br />&gt; archiving WAL on timeline 2 does not guarantee that standby2 replays it<br />&gt; before promotion. It can still be promoted while lastRecTLI is 1, so<br />&gt; the test would not prove that the restored timeline 2 history was used.<br />&gt; I think it needs to wait for the recorded timeline_2_lsn before calling<br />&gt; promote(), for example:<br />&gt;<br />&gt;     $caughtup_query =<br />&gt;       "SELECT '$timeline_2_lsn'::pg_lsn &lt;= pg_last_wal_replay_lsn()";<br />&gt;     $node_standby2-&gt;poll_query_until('postgres', $caughtup_query)<br />&gt;       or die "Timed out while waiting for standby2 to reach timeline 2";</div><div> </div><div>Hi, Andrey!<br /> </div><div>Thank you for the review. You are right, there is a race.</div><div> </div><div>In v2 i added suggested query to wait timeline_2_lsn. This will help<br />to avoid promotion before timeline2 is applied.</div><div> </div><div>Thank you!<br /><br />Best regards, Stepan Filippov.<br /> </div>

Attachment Content-Type Size
unknown_filename text/html 1.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-09-07 09:42:06 Re: Follow-up review items for update_deleted
Previous Message Ayoub Kazar 2026-09-07 09:32:57 Re: Add pg_stat_vfdcache view for VFD cache statistics