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-12T01:27:13Z
Lists: pgsql-hackers

Attachments

Hello Jeff,

> Shouldn't we use pg_usleep to ensure portability?  it is defined for
> front-end code.  But it returns void, so the error check will have to be
> changed.

Attached v3 with pg_usleep called instead.

> I didn't see the problem before the commit I originally indicated , so I
> don't think it has to be back-patched to before v10.

Hmmm.... you've got a point, although I'm not sure how it could work 
without sleeping explicitely. Maybe the path was calling select with an 
empty wait list plus timeout, and select is kind enough to just sleep on 
an empty list, or some other miracle. ISTM clearer to explicitely sleep in 
that case.

-- 
Fabien.

Commits

  1. Fix busy-wait in pgbench, with --rate.

  2. Refactor script execution state machine in pgbench.