Re: pgbench - minor fix for meta command only scripts
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Tom Lane <tgl@sss.pgh.pa.us>,
Michael Paquier <michael.paquier@gmail.com>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-09-04T20:56:32Z
Lists: pgsql-hackers
Attachments
- pgbench-rate-bug-1.patch (text/x-diff) patch
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.
Commits
-
Fix busy-wait in pgbench, with --rate.
- babf18579455 10.0 landed
- 396ef1561878 11.0 landed
-
Refactor script execution state machine in pgbench.
- 12788ae49e19 10.0 cited