Re: Progress reporting for pg_verify_checksums

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Progress reporting for pg_verify_checksums
Дата
Msg-id 20181226021400.GE2234@paquier.xyz
обсуждение исходный текст
Ответ на Re: Progress reporting for pg_verify_checksums  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: Progress reporting for pg_verify_checksums  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: Progress reporting for pg_verify_checksums  (Michael Banck <michael.banck@credativ.de>)
Список 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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: pg_dumpall --exclude-database option
Следующее
От: "Nagaura, Ryohei"
Дата:
Сообщение: RE: Timeout parameters