Re: The same 2PC data maybe recovered twice

From: "suyu(dot)cmj" <mengjuan(dot)cmj(at)alibaba-inc(dot)com>
To: "Michael Paquier" <michael(at)paquier(dot)xyz>
Cc: "pgsql-bugs" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: The same 2PC data maybe recovered twice
Date: 2025-07-09 01:57:08
Message-ID: c2307b91-de84-445f-8881-a4ea06b5421d.mengjuan.cmj@alibaba-inc.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi, all. I would like to sync up on an issue I've recently encountered. Previously, the following logic was added to the PrepareRedoAdd() when fixing this 2PC recovery bug:
------------------------------------------------------------------
From:Michael Paquier <michael(at)paquier(dot)xyz>
Send Time:2023 Jul. 18 (Tue.) 13:14
To:"蔡梦娟(玊于)"<mengjuan(dot)cmj(at)alibaba-inc(dot)com>
CC:"zhihui.fan1213"<zhihui(dot)fan1213(at)gmail(dot)com>; "pgsql-bugs"<pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject:Re: The same 2PC data maybe recovered twice
On Mon, Jul 17, 2023 at 05:20:00PM +0800, suyu.cmj wrote:
> Thanks for the feedback! I have updated the patch, hope you can check it.
I have looked at v3, and noticed that the stat() call is actually a
bit incorrect in its error handling because it would miss any errors
that happen when checking for the existence of the file. The only
error that we should safely expect is ENOENT, for a missing entry.
All the other had better fail like the other code paths restoring 2PC
entries from the shared state. At the end, I have made the choice of
relying only on access() to check the existence of the file as this is
an internal place, simplified a bit the comment. Finally, I have made
the choice to remove the assert-only check. After sleeping on it, it
would have value in very limited cases while a bunch of recovery cases
would take a hit, including developers with large 2PC setups, so there
are a lot of downsides with limited upsides.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message suyu.cmj 2025-07-09 05:51:03 Re: The same 2PC data maybe recovered twice
Previous Message Michael Paquier 2025-07-09 00:45:07 Re: BUG #18943: Return value of a function 'xmlBufferCreate' is dereferenced at xpath.c:177 without checking for NUL

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-07-09 02:19:07 Re: Adding wait events statistics
Previous Message Michael Paquier 2025-07-09 00:56:10 Re: Adding wait events statistics