pgbench - doCustom cleanup - Mailing list pgsql-hackers

From Fabien COELHO
Subject pgbench - doCustom cleanup
Date
Msg-id alpine.DEB.2.21.1808111104320.1705@lancre
Whole thread Raw
Responses RE: pgbench - doCustom cleanup
List 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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: logical decoding / rewrite map vs. maxAllocatedDescs
Next
From: Michael Paquier
Date:
Subject: Re: BUG #15182: Canceling authentication due to timeout aka Denialof Service Attack