pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix partial two-phase files left by crash during checkpoint
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix partial two-phase files left by crash during checkpoint
@ 2026-10-26 08:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-10-26 08:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Steele <david@pgbackrest.org>
Discussion: https://postgr.es/m/CAGRkXqS_On-pLgcv6xjH8mvGhdcPmfWtythW3r8pYKUG+hsiuQ@mail.gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a5ccf20801c821b72bb04d56b7320d52149a1ce5

Modified Files
--------------
src/backend/access/transam/twophase.c | 40 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix partial two-phase files left by crash during checkpoint
@ 2026-10-26 08:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-10-26 08:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Steele <david@pgbackrest.org>
Discussion: https://postgr.es/m/CAGRkXqS_On-pLgcv6xjH8mvGhdcPmfWtythW3r8pYKUG+hsiuQ@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2c4a3b3b265742ff449f3010575ce6c1e1dc0e93

Modified Files
--------------
src/backend/access/transam/twophase.c | 40 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix partial two-phase files left by crash during checkpoint
@ 2026-10-26 08:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-10-26 08:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Steele <david@pgbackrest.org>
Discussion: https://postgr.es/m/CAGRkXqS_On-pLgcv6xjH8mvGhdcPmfWtythW3r8pYKUG+hsiuQ@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/606f3db5595dc8459b3d41a081b3ae8ffaae05b9

Modified Files
--------------
src/backend/access/transam/twophase.c | 40 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix partial two-phase files left by crash during checkpoint
@ 2026-10-26 08:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-10-26 08:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Steele <david@pgbackrest.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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix partial two-phase files left by crash during checkpoint
@ 2026-10-26 08:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-10-26 08:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Steele <david@pgbackrest.org>
Discussion: https://postgr.es/m/CAGRkXqS_On-pLgcv6xjH8mvGhdcPmfWtythW3r8pYKUG+hsiuQ@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/11c87ab37f44d03b38b7856a42bccae68d358f3b

Modified Files
--------------
src/backend/access/transam/twophase.c | 40 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix partial two-phase files left by crash during checkpoint
@ 2026-10-26 08:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-10-26 08:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Steele <david@pgbackrest.org>
Discussion: https://postgr.es/m/CAGRkXqS_On-pLgcv6xjH8mvGhdcPmfWtythW3r8pYKUG+hsiuQ@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4b9009105b7a037b9025a4bc7f3c65445dcaaca8

Modified Files
--------------
src/backend/access/transam/twophase.c | 40 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix partial two-phase files left by crash during checkpoint
@ 2026-10-26 08:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-10-26 08:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Steele <david@pgbackrest.org>
Discussion: https://postgr.es/m/CAGRkXqS_On-pLgcv6xjH8mvGhdcPmfWtythW3r8pYKUG+hsiuQ@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b15c55163b68fc6f590436647fd8a6c9a9eaaf46

Modified Files
--------------
src/backend/access/transam/twophase.c | 40 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-10-26 08:17 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 08:17 pgsql: Fix partial two-phase files left by crash during checkpoint Michael Paquier <michael@paquier.xyz>
2026-10-26 08:17 pgsql: Fix partial two-phase files left by crash during checkpoint Michael Paquier <michael@paquier.xyz>
2026-10-26 08:17 pgsql: Fix partial two-phase files left by crash during checkpoint Michael Paquier <michael@paquier.xyz>
2026-10-26 08:17 pgsql: Fix partial two-phase files left by crash during checkpoint Michael Paquier <michael@paquier.xyz>
2026-10-26 08:17 pgsql: Fix partial two-phase files left by crash during checkpoint Michael Paquier <michael@paquier.xyz>
2026-10-26 08:17 pgsql: Fix partial two-phase files left by crash during checkpoint Michael Paquier <michael@paquier.xyz>
2026-10-26 08:17 pgsql: Fix partial two-phase files left by crash during checkpoint Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox