pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro
6+ messages / 1 participants
[nested] [flat]

* pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro
@ 2026-11-25 07:23  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-25 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_receivewal, pg_basebackup: Fix temporary file cleanup on errors

pg_receivewal and the WAL streaming process of pg_basebackup could leave
temporary files behind when closing them failed, even though their
removal had been requested. For example, a temporary timeline history
file could remain after a write failure, unnecessarily occupying disk
space.

This happened because dir_close() attempted to unlink a file requested
with CLOSE_UNLINK only if the preceding operations succeeded. Failures
while finalizing compression, writing the final compressed data, or
closing the file could therefore skip the unlink operation.

Fix this by moving the unlink operation into the common cleanup path,
so that it is attempted even after an earlier failure.

Backpatch to all supported versions.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/9C37FACF-2D67-450D-864A-344F81229860@gmail.com
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/650925dad03ae3f5048e234d167c9f15df1e9853

Modified Files
--------------
src/bin/pg_basebackup/walmethods.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)



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

* pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro
@ 2026-11-25 07:23  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-25 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_receivewal, pg_basebackup: Fix temporary file cleanup on errors

pg_receivewal and the WAL streaming process of pg_basebackup could leave
temporary files behind when closing them failed, even though their
removal had been requested. For example, a temporary timeline history
file could remain after a write failure, unnecessarily occupying disk
space.

This happened because dir_close() attempted to unlink a file requested
with CLOSE_UNLINK only if the preceding operations succeeded. Failures
while finalizing compression, writing the final compressed data, or
closing the file could therefore skip the unlink operation.

Fix this by moving the unlink operation into the common cleanup path,
so that it is attempted even after an earlier failure.

Backpatch to all supported versions.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/9C37FACF-2D67-450D-864A-344F81229860@gmail.com
Backpatch-through: 15

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/bin/pg_basebackup/walmethods.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)



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

* pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro
@ 2026-11-25 07:23  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-25 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_receivewal, pg_basebackup: Fix temporary file cleanup on errors

pg_receivewal and the WAL streaming process of pg_basebackup could leave
temporary files behind when closing them failed, even though their
removal had been requested. For example, a temporary timeline history
file could remain after a write failure, unnecessarily occupying disk
space.

This happened because dir_close() attempted to unlink a file requested
with CLOSE_UNLINK only if the preceding operations succeeded. Failures
while finalizing compression, writing the final compressed data, or
closing the file could therefore skip the unlink operation.

Fix this by moving the unlink operation into the common cleanup path,
so that it is attempted even after an earlier failure.

Backpatch to all supported versions.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/9C37FACF-2D67-450D-864A-344F81229860@gmail.com
Backpatch-through: 15

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/bin/pg_basebackup/walmethods.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)



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

* pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro
@ 2026-11-25 07:23  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-25 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_receivewal, pg_basebackup: Fix temporary file cleanup on errors

pg_receivewal and the WAL streaming process of pg_basebackup could leave
temporary files behind when closing them failed, even though their
removal had been requested. For example, a temporary timeline history
file could remain after a write failure, unnecessarily occupying disk
space.

This happened because dir_close() attempted to unlink a file requested
with CLOSE_UNLINK only if the preceding operations succeeded. Failures
while finalizing compression, writing the final compressed data, or
closing the file could therefore skip the unlink operation.

Fix this by moving the unlink operation into the common cleanup path,
so that it is attempted even after an earlier failure.

Backpatch to all supported versions.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/9C37FACF-2D67-450D-864A-344F81229860@gmail.com
Backpatch-through: 15

Branch
------
REL_17_STABLE

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

Modified Files
--------------
src/bin/pg_basebackup/walmethods.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)



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

* pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro
@ 2026-11-25 07:23  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-25 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_receivewal, pg_basebackup: Fix temporary file cleanup on errors

pg_receivewal and the WAL streaming process of pg_basebackup could leave
temporary files behind when closing them failed, even though their
removal had been requested. For example, a temporary timeline history
file could remain after a write failure, unnecessarily occupying disk
space.

This happened because dir_close() attempted to unlink a file requested
with CLOSE_UNLINK only if the preceding operations succeeded. Failures
while finalizing compression, writing the final compressed data, or
closing the file could therefore skip the unlink operation.

Fix this by moving the unlink operation into the common cleanup path,
so that it is attempted even after an earlier failure.

Backpatch to all supported versions.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/9C37FACF-2D67-450D-864A-344F81229860@gmail.com
Backpatch-through: 15

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/bin/pg_basebackup/walmethods.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)



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

* pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro
@ 2026-11-25 07:23  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-25 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_receivewal, pg_basebackup: Fix temporary file cleanup on errors

pg_receivewal and the WAL streaming process of pg_basebackup could leave
temporary files behind when closing them failed, even though their
removal had been requested. For example, a temporary timeline history
file could remain after a write failure, unnecessarily occupying disk
space.

This happened because dir_close() attempted to unlink a file requested
with CLOSE_UNLINK only if the preceding operations succeeded. Failures
while finalizing compression, writing the final compressed data, or
closing the file could therefore skip the unlink operation.

Fix this by moving the unlink operation into the common cleanup path,
so that it is attempted even after an earlier failure.

Backpatch to all supported versions.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/9C37FACF-2D67-450D-864A-344F81229860@gmail.com
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5f73181c06f49ba33e1abceceb0eeaab19fb9e13

Modified Files
--------------
src/bin/pg_basebackup/walmethods.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)



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


end of thread, other threads:[~2026-11-25 07:23 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 07:23 pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro Fujii Masao <fujii@postgresql.org>
2026-11-25 07:23 pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro Fujii Masao <fujii@postgresql.org>
2026-11-25 07:23 pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro Fujii Masao <fujii@postgresql.org>
2026-11-25 07:23 pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro Fujii Masao <fujii@postgresql.org>
2026-11-25 07:23 pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro Fujii Masao <fujii@postgresql.org>
2026-11-25 07:23 pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro Fujii Masao <fujii@postgresql.org>

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