Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1041643

Browse filesBrowse files
committed
pg_checksums: Fix progress reporting.
pg_checksums uses two counters, total size and current size, to calculate the progress. Previously the progress that pg_checksums reported could not reach 100% at the end. The cause of this issue was that the sizes of only pages excluding new ones in each file were counted as the current size while the size of each file is counted as the total size. That is, the total size of all new pages could be reported as the difference between the total size and current size. This commit fixes this issue by making pg_checksums count the sizes of all pages including new ones in each file as the current size. Back-patch to v12 where progress reporting was added to pg_checksums. Reported-by: Shinya Kato Author: Shinya Kato Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/TYAPR01MB289656B1ACA0A5E7CAD07BE3C47A9@TYAPR01MB2896.jpnprd01.prod.outlook.com
1 parent f8c2d49 commit 1041643
Copy full SHA for 1041643

File tree

Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed

‎src/bin/pg_checksums/pg_checksums.c

Copy file name to clipboardExpand all lines: src/bin/pg_checksums/pg_checksums.c
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,19 @@ scan_file(const char *fn, BlockNumber segmentno)
229229
}
230230
blocks++;
231231

232+
/*
233+
* Since the file size is counted as total_size for progress status
234+
* information, the sizes of all pages including new ones in the file
235+
* should be counted as current_size. Otherwise the progress reporting
236+
* calculated using those counters may not reach 100%.
237+
*/
238+
current_size += r;
239+
232240
/* New pages have no checksum yet */
233241
if (PageIsNew(header))
234242
continue;
235243

236244
csum = pg_checksum_page(buf.data, blockno + segmentno * RELSEG_SIZE);
237-
current_size += r;
238245
if (mode == PG_MODE_CHECK)
239246
{
240247
if (csum != header->pd_checksum)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.