Re: pgbench -i progress output on terminal

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench -i progress output on terminal
Date: 2019-12-03 01:30:35
Message-ID: CA+HiwqEP=xe_CraffpygHUqwDCOP9JG9HiwvHFjEzgi06B45ig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review.

On Mon, Dec 2, 2019 at 3:28 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> On Mon, Dec 02, 2019 at 02:30:47PM +0900, Amit Langote wrote:
> > On Sun, Dec 1, 2019 at 4:33 AM Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
> >> Patch applies, compiles, works for me. No further comments.
> >>
> >> I switched the patch as ready.
> >
> > Thanks a lot.
>
> An issue with the patch as proposed is that its style is different
> than what pg_rewind and pg_basebackup do in the same cases, but who
> cares :)

How about adding a function, say print_progress_to_stderr(const char
*fmt,...), exposed to the front-end utilities and use it from
everywhere? Needless to say that it will contain the check for whether
stderr points to terminal or a file and print accordingly.

> By the way, the first patch sent on this thread had a bug when
> redirecting the output of stderr to a log file because it was printing
> a newline for each loop done on naccounts, but you just want to print
> a log every 100 rows or 100k rows depending on if the quiet mode is
> used or not, so the log file grew in size with mostly empty lines.

Naive programming :(

> Another question I have is why doing only that for the data
> initialization phase? Wouldn't it make sense to be consistent with
> the other tools having --progress and do the same dance in pgbench's
> printProgressReport()?

Considering Fabien's comment on this, we will have to check which
other instances are printing information that is not very useful to
look at line-by-line.

> NB: Note as well that pgindent complains for one thing, a newline
> before the call to isatty.

Fixed.

Attached v4.

Thanks,
Amit

Attachment Content-Type Size
compactify-pgbench-init-progress-output_v4.patch application/octet-stream 2.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ioseph Kim 2019-12-03 02:51:55 add age for databases list in psql
Previous Message Alexander Korotkov 2019-12-03 00:00:03 Re: [PATCH] kNN for btree