mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Adjust total size in pg_basebackup progress report when reality changes
When streaming including WAL, the size estimate will always be incorrect, since we don't know how much WAL is included. To make sure the output doesn't look completely unreasonable, this patch increases the total size whenever we go past the estimate, to make sure we never go above 100%.
This commit is contained in:
parent
2877c67bc2
commit
1bb69245ab
@ -207,8 +207,17 @@ progress_report(int tablespacenum, const char *filename)
|
||||
char totaldone_str[32];
|
||||
char totalsize_str[32];
|
||||
|
||||
/*
|
||||
* Avoid overflowing past 100% or the full size. This may make the
|
||||
* total size number change as we approach the end of the backup
|
||||
* (the estimate will always be wrong if WAL is included), but
|
||||
* that's better than having the done column be bigger than the
|
||||
* total.
|
||||
*/
|
||||
if (percent > 100)
|
||||
percent = 100;
|
||||
if (totaldone / 1024 > totalsize)
|
||||
totalsize = totaldone / 1024;
|
||||
|
||||
/*
|
||||
* Separate step to keep platform-dependent format code out of translatable
|
||||
|
Loading…
Reference in New Issue
Block a user