Re: The same 2PC data maybe recovered twice

From: "suyu(dot)cmj" <mengjuan(dot)cmj(at)alibaba-inc(dot)com>
To: "Andy Fan" <zhihui(dot)fan1213(at)gmail(dot)com>
Cc: "pgsql-bugs" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: The same 2PC data maybe recovered twice
Date: 2023-07-12 07:20:57
Message-ID: 27cf1fe2-e8f9-4fca-a828-aa3ad3397acd.mengjuan.cmj@alibaba-inc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Yes, this bug can also be reproduced on the master branch, and the corresponding reproduction patch is attached.
I also considered comparing the 2pc.prepare_start_lsn and checkpoint.redo in ProcessTwoPhaseBuffer before, but this method requires modifying the format of the 2pc checkpoint file, which will bring compatibility issues. Especially for released branches, assuming that a node has encountered this bug, it will not be able to start successfully due to FATAL during crash recovery, and therefore cannot manually commit previous two-phase transactions. Using magic number to distinguish 2pc checkpoint file versions can't solve the problem in the above scenario either.
For unreleased branches, writing 2pc.prepare_start_lsn into the checkpoint file will be a good solution, but for released branches, I personally think using WAL record to overwrite checkpoint data would be a more reasonable approach, What do you think?
Best Regards
suyu.cmj

Attachment Content-Type Size
0001-Reproduce-the-error_master.patch application/octet-stream 6.6 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-07-12 10:08:54 BUG #18019: misbehaviour by replication
Previous Message Andy Fan 2023-07-12 02:57:44 Re: The same 2PC data maybe recovered twice

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-07-12 07:34:42 Re: Exclusion constraints on partitioned tables
Previous Message Hayato Kuroda (Fujitsu) 2023-07-12 07:07:45 RE: [Patch] Use *other* indexes on the subscriber when REPLICA IDENTITY is FULL