| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix partial two-phase files left by crash during checkpoint |
| Date: | 2026-10-26 08:17:27 |
| Message-ID: | E1xLFtX-00000000oG7-2YXs@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix partial two-phase files left by crash during checkpoint
CheckPointTwoPhase() wrote each 2PC file in place, with O_TRUNC. A
crash mid-write, or a base backup copying the file at that point left an
empty or partial file that would make startup fail, most likely on an
"incorrect size of file" ERROR.
The 2PC files are now written through a temporary file that gets renamed
at the end, relying on the atomicity of the rename to make startup safe,
be it after a crash or a base backup.
Author: Shihao Zhong <zhong950419(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: David Steele <david(at)pgbackrest(dot)org>
Discussion: https://postgr.es/m/CAGRkXqS_On-pLgcv6xjH8mvGhdcPmfWtythW3r8pYKUG+hsiuQ@mail.gmail.com
Backpatch-through: 14
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/15f57b683d236b7dad4d57d03d8b7bac0e63a204
Modified Files
--------------
src/backend/access/transam/twophase.c | 40 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-10-26 10:00:33 | pgsql: pg_combinebackup: Reject out-of-range block numbers in increment |
| Previous Message | Richard Guo | 2026-10-26 02:33:29 | pgsql: Don't build child-join EC members that reference outside rels |