Re: The same 2PC data maybe recovered twice
(unknown)
From: CAI, Mengjuan <mengjuan.cmj@alibaba-inc.com>
To: "Michael Paquier" <michael@paquier.xyz>
Cc: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2025-07-14T06:46:25Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- 0001-Fix-2PC-file-check-logic-in-PrepareRedoAdd.patch (application/octet-stream) patch 0001
Hi Michael, Thank you for your reply. I reviewed the thread you mentioned, and it seems that the issue needing to be fixed is not the same as the one I previously raised. I am considering whether the 2PC file check logic in PrepareRedoAdd() can be modified. Currently, each time a XLOG_XACT_PREPARE WAL entry is replayed, it checks for the corresponding 2PC file using access(). Each access operation creates a dentry in the OS, and in most cases, the file being accessed does not exist. When there are many 2PC transactions, this logic may lead to an increase in OS slab memory. In worse scenarios, it could cause the reference count of the parent directory's dentry to overflow, potentially leading to an OS crash. Typically, when accessing existing files, the disk will fill up before the dentry reference count overflows. Therefore, I would like to propose a modification. Attached is my patch for your review, and I hope you can take a look at it. Best regards, suyu.cmj
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix recovery of 2PC transaction during crash recovery
- bc0581f8fb8b 11.21 landed
- d2ee542a2bbe 12.16 landed
- db59108a2b67 13.12 landed
- 442749100d34 14.9 landed
- a878eff6b4b9 15.4 landed
- f88bc9f38839 16.0 landed
- cb0cca188072 17.0 landed