pgbench - doCustom cleanup
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-08-11T09:14:09Z
Lists: pgsql-hackers
Attachments
- pgbench-state-change-2.patch (text/plain) patch
Hello pgdev,
This patch rework & clarifies pgbench internal state machine.
It was indirectly triggered by Heikki review of pgbench tap tests
(https://commitfest.postgresql.org/19/1306/), and by Marina's patch about
tx retry on some errors (https://commitfest.postgresql.org/19/1645/) which
I am reviewing.
- it adds more comments to the enum state definitions and to doCustom.
- there is some code cleanup/simplifications:
. a few useless intermediate variables are removed,
. a macro is added to avoid a repeated pattern to set the current time,
. performance data are always collected instead of trying to be clever
and not collect some data in some cases.
- more fundamentally, all state changes are performed within doCustom,
prior that there was one performed by threadRun which made undertanding
the end of run harder. Now threadRun only look at the current state
to make decisions about a client.
- doCustom is made to always return at the end of a script to avoid
an infinite loop on backslash-command only script, instead of hack
with a variable to detect loops, which made it return every two
script runs in such cases.
- there is a small behavioral change:
prior to the patch, a script would always run to its end once started,
with the exception of \sleep commands which could be interrupted by
threadRun.
Marina's patch should enforce somehow one script = one transaction so
that a retry makes sense, so this exception is removed to avoid
aborting a tx implicitely.
--
Fabien.
Commits
-
pgbench: doExecuteCommand -> executeMetaCommand
- 9938d1163310 12.0 landed
-
Rework the pgbench state machine code for clarity
- 3bac77c48f16 12.0 landed
-
instr_time.h: add INSTR_TIME_SET_CURRENT_LAZY
- 6f7d02aa60b7 12.0 landed
-
pgbench: introduce a RandomState struct
- 409231919443 12.0 cited