pg_basebackup: Report correct size estimate for incremental backups

Progress reporting in pg_basebackup and pg_stat_progress_basebackup used
the estimated size of a full backup even when taking an incremental backup.
The size estimation pass did not account for incremental files and counted
every file at its full size. Progress could therefore remain at only a few
percent even after the incremental backup completed successfully.

Fix this by making the size estimation pass account for incremental files,
counting them at the size they will occupy in the archive.

Backpatch to 17, where incremental backup was introduced.

Author: Daria Lepikhova <[email protected]>
Reviewed-by: Manuel Reyes Bravo <[email protected]>
Reviewed-by: Zsolt Parragi <[email protected]>
Reviewed-by: Surya Poondla <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: 
https://postgr.es/m/cak49s1aswk7l-7lyuuz1mu_+uqnz75srva2xrr4r-w0hcvz...@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_17_STABLE

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

Modified Files
--------------
doc/src/sgml/protocol.sgml                         |  9 ++-
src/backend/backup/basebackup.c                    |  7 +-
src/backend/backup/basebackup_incremental.c        |  4 +
src/bin/pg_basebackup/meson.build                  |  1 +
.../pg_basebackup/t/012_incremental_progress.pl    | 85 ++++++++++++++++++++++
5 files changed, 102 insertions(+), 4 deletions(-)

Reply via email to