diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c index c3e5704cdd..2a749266ad 100644 --- a/src/bin/pg_checksums/pg_checksums.c +++ b/src/bin/pg_checksums/pg_checksums.c @@ -228,12 +228,19 @@ scan_file(const char *fn, BlockNumber segmentno) } blocks++; + /* + * Since the file size is counted as total_size for progress status + * information, the sizes of all pages including new ones in the file + * should be counted as current_size. Otherwise the progress reporting + * calculated using those counters may not reach 100%. + */ + current_size += r; + /* New pages have no checksum yet */ if (PageIsNew(header)) continue; csum = pg_checksum_page(buf.data, blockno + segmentno * RELSEG_SIZE); - current_size += r; if (mode == PG_MODE_CHECK) { if (csum != header->pd_checksum)