Re: Progress reporting for pg_verify_checksums
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Michael Banck <michael.banck@credativ.de>
Cc: Michael Paquier <michael@paquier.xyz>,
Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>,
alvherre@2ndquadrant.com, mailings@oopsware.de,
thomas.munro@enterprisedb.com, pgsql-hackers@postgresql.org
Date: 2019-03-28T08:41:57Z
Lists: pgsql-hackers
Hallo Michael, >> Or anything which converts to double early. > Are you sure, seeing elapsed is a double already? Argh, I missed that. You are right that a double elapsed is enough for the second part. However, with + current_speed = (current_size / MEGABYTES) / (elapsed / 1000.0); the first division is an integer one because both operands are ints, so megabytes conversion is rounded down. I'd suggest: + current_speed = ((double) current_size / MEGABYTES) / (elapsed / 1000); > If I print out two additional fractional digits for current_speed, I get > two non-zero numbers, are those garbage? Nope, they come from the other divisions, but the fist division will have wipped out 0.5 MiB on average. >> Ok, it is more complicated that it looks for large sizes if second is not >> the right display unit. > > Right, new version attached. Applies, compiles, global & local "make check" (although not tested) ok, doc build ok, manual tests ok. Otherwise a very minor comment: I'd invert !force and the computations in the return condition to avoid the computations when not needed. -- Fabien.
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