Re: pgbench - minor fix for meta command only scripts

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench - minor fix for meta command only scripts
Date: 2017-09-04 20:56:32
Message-ID: alpine.DEB.2.20.1709042249120.19424@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Jeff,

>>> I have fixed a bug introduced in the patch by changing && by || in the
>>> (min_sec > 0 && maxsock != -1) condition which was inducing errors with
>>> multi-threads & clients...

> Since this commit (12788ae49e1933f463bc5), if I use the --rate to throttle
> the transaction rate, it does get throttled to about the indicated speed,
> but the pg_bench consumes the entire CPU.
>
>
> At the block of code starting
> if (min_usec > 0 && maxsock != -1)
>
> If maxsock == -1, then there is no sleep happening.

Argh, shame on me:-(

I cannot find the "induced errors" I was refering to in the message...
Sleeping is definitely needed to avoid a hard loop.

Patch attached fixes it and does not seem introduce any special issue...

Should probably be backpatched.

Thanks for the debug!

--
Fabien.

Attachment Content-Type Size
pgbench-rate-bug-1.patch text/x-diff 464 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2017-09-04 21:21:08 Re: pgbench - minor fix for meta command only scripts
Previous Message Andres Freund 2017-09-04 20:52:04 Re: JIT compiling expressions/deform + inlining prototype v2.0