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.
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 364e254..3e23a6a 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -4587,7 +4587,7 @@ threadRun(void *arg)
* or it's time to print a progress report. Update input_mask to show
* which client(s) received data.
*/
- if (min_usec > 0 && maxsock != -1)
+ if (min_usec > 0 || maxsock != -1)
{
int nsocks; /* return from select(2) */
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers