fix_pg_checksums_progress_report_v3.patch
application/octet-stream
Filename: fix_pg_checksums_progress_report_v3.patch
Type: application/octet-stream
Part: 0
Message:
RE: Fix pg_checksums progress report
Patch
Format: unified
Series: patch v3
| File | + | − |
|---|---|---|
| src/bin/pg_checksums/pg_checksums.c | 8 | 1 |
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
index 0223ee4408..831cf42d3a 100644
--- a/src/bin/pg_checksums/pg_checksums.c
+++ b/src/bin/pg_checksums/pg_checksums.c
@@ -229,12 +229,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)