pgbench - doCustom cleanup

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: pgbench - doCustom cleanup
Date: 2018-08-11 09:14:09
Message-ID: alpine.DEB.2.21.1808111104320.1705@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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.

Attachment Content-Type Size
pgbench-state-change-2.patch text/plain 16.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-08-11 09:50:03 Re: BUG #15182: Canceling authentication due to timeout aka Denial of Service Attack
Previous Message Andres Freund 2018-08-11 07:57:56 Re: logical decoding / rewrite map vs. maxAllocatedDescs