Re: Fix for Extra Parenthesis in pgbench progress message

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Tatsuo Ishii <ishii(at)postgresql(dot)org>, pgsql-release(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix for Extra Parenthesis in pgbench progress message
Date: 2025-02-07 18:11:16
Message-ID: u3wrfwgawr2sg2poi6bj2pyoter7g3oiszatrsaunpk3c3klm2@msu46rbljm7f
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-02-07 12:58:38 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I just did pgbench -i 100 -q via ssh and noticed it was *way* slower than I
> > expected. Did it with debian's pgbench, no such issue.
>
> > It's due to this patch.
>
> Oh! The problem is that the hunk
>
> + /*
> + * If the previous progress message is longer than the current one,
> + * add spaces to the current line to fully overwrite any remaining
> + * characters from the previous message.
> + */
> + if (prev_chars > chars)
> + fprintf(stderr, "%*c", prev_chars - chars, ' ');
> + fputc(eol, stderr);
> + prev_chars = chars;
>
> is executed unconditionally for each data row, when we should only run
> it when we printed something.

Yea, that would do it.

> Trying it here, it also makes the thing practically unresponsive to
> control-C.

Interestingly I don't see that aspect...

> > Given the upcoming set of minor releases, I think it may be best for this this
> > patch ought to be reverted for now.
>
> Seems easy enough to fix. But it's now middle of the night Saturday
> morning in Japan, so I doubt Masao-san or Ishii-san will see this
> for awhile. And the release freeze is coming up fast.
>
> Let me have a go at fixing it, and if it turns out to be harder
> than I think, I'll revert it instead.

Makes sense!

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-02-07 18:13:37 Re: Fix for Extra Parenthesis in pgbench progress message
Previous Message Tom Lane 2025-02-07 18:10:04 Re: Fix for Extra Parenthesis in pgbench progress message