Re: Racing in ROLLBACK PREAPRED and checkpoint

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Racing in ROLLBACK PREAPRED and checkpoint
Date: 2026-11-02 06:36:51
Message-ID: augvg-Yleij-uv5o@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 01, 2026 at 10:37:16PM -0500, shihao zhong wrote:
> Thanks for looking into this.

At the end I have no objection to setting up the checkpoint start flag
to close this race, so applied down to v14. I have reworded quite a
bit the comments, though, to mention a little bit more the
similarities with the COMMIT PREPARED path and somewhat the regular
COMMIT path, as these relate as well to the pg_xact updates. The
difference here is that the file is on disk.

> One is multixact creation [1].
>
> The other two are CLOG truncation and hash index bucket allocation [2].

I am not sure of I will be able to look at any of them, but perhaps
others will be able to chime in.

Another thing that is worth mentioning here is that we have more
problems around 2PC and recovery setups. See the reason behind
a6c70f68cdeb and its thread:
https://postgr.es/m/20250116010051.f3.nmisch@google.com

There is a deeper design issue in this area of the code where we have
the idea to look at the CLOGs for the commit or aborted states of the
2PC transactions without having reached a consistent state (both crash
and base backup recovery included). In this case the CLOG data may be
inconsistent.

It's different than what you have reported here: it's not OK to have a
checkpoint discard data we are going to need to decide if a 2PC
transaction has been aborted or not.

While the test is useful to reproduce the issue, I was not sure that
it is mandatory to run it for such a short race window, so I have left
it out of the equation. If anybody has else has an opinion to offer
about that, feel free.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2026-11-02 06:46:04 Re: PostgreSQL 19 GA press release draft
Previous Message Keyerror Smart 2026-11-02 06:29:53 Re: [PATCH]Fix planner's strictness check for JsonExpr