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