Re: pgbench - minor fix for meta command only scripts
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Jeff Janes <jeff.janes@gmail.com>, 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-29T21:31:17Z
Lists: pgsql-hackers
On Mon, Sep 11, 2017 at 4:49 AM, Fabien COELHO <coelho@cri.ensmp.fr> wrote: > Ok, the problem was a little bit more trivial than I thought. > > The issue is that under a low rate there may be no transaction in progress, > however the wait procedure was relying on select's timeout. If nothing is > active there is nothing to wait for, thus it was an active loop in this > case... > > I've introduced a usleep call in place of select for this particular case. > Hopefully this is portable. > > ISTM that this bug exists since rate was introduced, so shame on me and > back-patching should be needed. I took a look at this and found that the proposed patch applies cleanly all the way back to 9.5, but the regression is reported to have begun with a commit that starts in v10. I haven't probed into this in any depth, but are we sure that 12788ae49e1933f463bc59a6efe46c4a01701b76 is in fact where this problem originated? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
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