]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Clear base backup progress on backup failure
authorFujii Masao <fujii@postgresql.org>
Wed, 1 Jul 2026 14:05:34 +0000 (23:05 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 1 Jul 2026 14:05:34 +0000 (23:05 +0900)
commite2ea6bfed8803cd8d11b5cd85f9669a57d517735
tree373103596876f2e74bd9dbbdb8dfb305b3f91808
parent4d99e6ed640e3a214875b814d489c4d8ce8f77b1
Clear base backup progress on backup failure

Previously, if a base backup failed after it had started streaming
files, pg_stat_progress_basebackup could continue to show a stale
progress entry even though the backup was no longer running. This could
be observed when the client kept the replication connection open after
the error. It is normally not observable when using pg_basebackup,
because the client disconnects after the error.

The problem was that progress reporting was cleared only after
successful completion.

This commit moves the progress reporting cleanup into the progress
sink's cleanup callback so that it is cleared after both successful
and failed backups.

Backpatch to v15. v14 has the same issue, but the fix does not apply
cleanly because it lacks the base backup sink infrastructure. Since
the bug does not affect the backup itself and is normally not
observable when using pg_basebackup, skip the v14 backpatch.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/EA1A6CD2-EFA6-462B-9A02-03003555AB4A@gmail.com
Backpatch-through: 15
src/backend/backup/basebackup.c
src/backend/backup/basebackup_progress.c
src/include/backup/basebackup_sink.h