pgsql: Refactor script execution state machine in pgbench.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Refactor script execution state machine in pgbench.
Date: 2016-09-26 07:56:48
Message-ID: E1boQmO-0000U8-0D@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Refactor script execution state machine in pgbench.

The doCustom() function had grown into quite a mess. Rewrite it, in a more
explicit state machine style, for readability.

This also fixes one minor bug: if a script consisted entirely of meta
commands, doCustom() never returned to the caller, so progress reports
with the -P option were not printed. I don't want to backpatch this
refactoring, and the bug is quite insignificant, so only commit this to
master, and leave the bug unfixed in back-branches.

Review and original bug report by Fabien Coelho.

Discussion: <alpine(dot)DEB(dot)2(dot)20(dot)1607090850120(dot)3412(at)sto>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/12788ae49e1933f463bc59a6efe46c4a01701b76

Modified Files
--------------
src/bin/pgbench/pgbench.c | 1106 +++++++++++++++++++++++++++------------------
1 file changed, 661 insertions(+), 445 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-09-26 12:53:51 Re: pgsql: pg_ctl: Detect current standby state from pg_control
Previous Message Michael Paquier 2016-09-26 02:18:54 Re: pgsql: pg_ctl: Detect current standby state from pg_control