pgbench: introduce a RandomState struct

Alvaro Herrera <alvherre@alvh.no-ip.org>

Commit: 409231919443984635b7ae9b7e2e261ab984eb1e
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2018-11-16T19:34:13Z
Releases: 12.0
pgbench: introduce a RandomState struct

This becomes useful when used to retry a transaction after a
serialization error or deadlock abort.  (We don't yet have that feature,
but this is preparation for it.)

While at it, use separate random state for thread administratrivia such
as deciding which script to run, how long to delay for throttling, or
whether to log a message when sampling; this not only makes these tasks
independent of each other, but makes the actual thread run
deterministic.

Author: Marina Polyakova
Reviewed-by: Fabien Coelho
Discussion: https://postgr.es/m/72a0d590d6ba06f242d75c2e641820ec@postgrespro.ru

Files

PathChange+/−
src/bin/pgbench/pgbench.c modified +74 −32

Discussion