Re: Progress reporting for pg_verify_checksums
Michael Banck <michael.banck@credativ.de>
From: Michael Banck <michael.banck@credativ.de>
To: Fabien COELHO <fabien.coelho@mines-paristech.fr>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Bernd Helmle
<mailings@oopsware.de>, Michael Paquier <michael@paquier.xyz>, Thomas Munro
<thomas.munro@enterprisedb.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2019-03-12T14:13:33Z
Lists: pgsql-hackers
Attachments
- pg_verify_checksums_progress_V10.patch (text/x-patch) patch
Hi, Am Dienstag, den 19.02.2019, 16:37 +0100 schrieb Fabien COELHO > > About : > > total_percent = total_size ? (int64) ((current_size / MEGABYTES) * 100 / (total_size / MEGABYTES)) : 0; > > MEGABYTES can be simplified and will enhance precision. ISTM that the > percent could be a double: > > total_percent = total_size ? 100.0 * current_size / total_size : 0.0 ; > > and then just let fprintf do the rounding. Ok, done so. > I would bother rounding down < 100% to 100, because then you would get > > 1560/1492 MB (100\%, X MB/s) > > which is kind of silly. No, we cap the total_size to current_size so you won't see that (but total_size will potentially gradually increase). pg_basebackup has the same behaviour. > I'd still would use more precise than one second precision time so that > the speed displayed at the beginning is more realistic. eg I got on a > short test with probably in system cache files: > > 188/188 MB (100%, 188 MB/s) > > but the reality is that it took 0.126 seconds, and the speed was really > 1492 MB/s. Because I implemented I/O throttling for pg_checksums and needed it there anyway, I've switched it to the instr_time API now. It now updates the progress 10 times every second. So now I get |20/20 MB (100%, 1382 MB/s) for an empty cluster vs |20/20 MB (100%, 20 MB/s) with the previous version of the patch. New patch attached. Michael -- Michael Banck Projektleiter / Senior Berater Tel.: +49 2166 9901-171 Fax: +49 2166 9901-100 Email: michael.banck@credativ.de credativ GmbH, HRB Mönchengladbach 12080 USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer Unser Umgang mit personenbezogenen Daten unterliegt folgenden Bestimmungen: https://www.credativ.de/datenschutz
Commits
-
Add progress reporting to pg_checksums
- 280e5f14056b 12.0 landed
-
Fix thinko when bumping on temporary directories in pg_verify_checksums
- da453004869d 11.3 landed
-
Fix thinko when bumping on temporary directories in pg_checksums
- 6eebfdc38b17 12.0 landed