| From: | Mats Kindahl <mats(dot)kindahl(at)gmail(dot)com> |
|---|---|
| To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
| Cc: | Japin Li <japinli(at)hotmail(dot)com>, pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pg_rewind does not rewind diverging timelines |
| Date: | 2026-09-03 19:21:41 |
| Message-ID: | 5407e386-3d61-4712-99af-9d0b29fab3b2@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Andrey, and thank you for the comments.
On 8/30/26 19:35, Andrey Borodin wrote:
> Hi Mats,
>
> On Tue, Aug 12, 2026, Mats Kindahl wrote:
>> Even with a shared archive, it is impossible to ensure such things. It
>> is a normal consensus problem.
> This race came up again in an open-space discussion here. What do you
> think about allowing a promotion request to supply the new TimelineID?
> In managed HA setups, the tool that decides which node may promote
> normally already has a DCS. It could allocate the TLI through the DCS
> while selecting the new primary, then pass it to PostgreSQL. PostgreSQL
> would still validate that it is greater than the current TLI and does
> not conflict with any history file it can see. This would prevent the
> collision when such a coordinator exists, while the UUID could remain a
> last-resort check for uncoordinated promotions.
If we have some sort of API or callback for assigning a new TLI that
would be excellent. Would be useful for a bunch of DCS as a way to
ensure that you do not pick a conflicting TLI. Should probably be
configurable though, but a normal hook callback would probably be
sufficient... and yes, the UUID is good to have as a last-resort check
to ensure that you don't break things.
>
> archive_command and restore_command are file-transfer interfaces. They
> cannot express an atomic allocation, so they seem like the wrong place
> to solve the distributed problem of choosing an identifier.
Yup, agree.
>
> At least until PostgreSQL gets built-in Paxos. Every joke contains a
> grain of joke, though; Kostya Osipov's related built-in consensus thread
> is [0].
Would love to see that. Kostja would definitely know how to implement
that. :)
>
> Would this fit the model you have in mind?
That would work fine. My main concern about adding UUIDs were to prevent
problems when you accidentally allocate same TLI to timelines that are
not the same. Integration hooks with a DCS would be icing on the cake. :)
Best wishes,
Mats Kindahl
>
> Thank you!
>
>
> Best regards, Andrey Borodin.
>
> [0]https://www.postgresql.org/message-id/flat/Z_1Cq7JvabsFYjQo%40ark
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-09-03 19:29:41 | Re: Fix a typo in EnableLogicalDecoding() |
| Previous Message | Alexander Lakhin | 2026-09-03 19:00:00 | Re: Stabilize recovery conflict stats checks in 031_recovery_conflict.pl |