Re: Progress reporting for pg_verify_checksums
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Michael Banck <michael.banck@credativ.de>, Thomas Munro <thomas.munro@enterprisedb.com>, Bernd Helmle <bernd.helmle@credativ.de>, Pg Hackers <pgsql-hackers@postgresql.org>, Alvaro Herrera <alvherre@2ndquadrant.com>
Date: 2018-12-26T02:14:00Z
Lists: pgsql-hackers
On Tue, Dec 25, 2018 at 07:05:30PM +0100, Fabien COELHO wrote: > You use 1024² bytes. What about 1000000 bytes per MB, as the unit is about > stored files? > > Also, you did not answer to my other points: > - use "instr_time.h" for better precision > - invert sizeonly > - reuse a test It seems to me that the SIGUSR1 business is not necessary for the basic layer of this feature, so I would rather rip that off now. If necessary we could always discuss that later on. My take about the option is that --progress should not be the default, but that reports should only be provided if the caller wants them. --quiet may have some value by itself, but that seems like a separate discussion to me. + /* + * If we are reporting to a terminal, send a carriage return so that we + * stay on the same line. If not, send a newline. + */ + if (isatty(fileno(stderr))) + fprintf(stderr, "\r"); + else + fprintf(stderr, "\n"); This bit is not really elegant, why not just '\r'? + /* The same for total size */ + if (current_size > total_size) + total_size = current_size / 1048576; Let's use that in a variable and not hardcode the number. What's introduced here is very similar to what progress_report() does in pg_rewind/logging.c. The report depends on the context so this cannot be a common routine logic but perhaps we could keep a consistent output for both tools? -- Michael
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