postgresql/src/bin
Alvaro Herrera 038f586d5f
pgbench: Prepare commands in pipelines in advance
Failing to do so results in an error when a pgbench script tries to
start a serializable transaction inside a pipeline, because by the time
BEGIN ISOLATION LEVEL SERIALIZABLE is executed, we're already in a
transaction that has acquired a snapshot, so the server rightfully
complains.

We can work around that by preparing all commands in the pipeline before
actually starting the pipeline.  This changes the existing code in two
aspects: first, we now prepare each command individually at the point
where that command is about to be executed; previously, we would prepare
all commands in a script as soon as the first command of that script
would be executed.  It's hard to see that this would make much of a
difference (particularly since it only affects the first time to execute
each script in a client), but I didn't actually try to measure it.

Secondly, we no longer use PQsendPrepare() in pipeline mode, but only
PQprepare.  There's no specific reason for this change other than no
longer needing to do differently in pipeline mode.  (Previously we had
no choice, because in pipeline mode PQprepare could not be used.)

Backpatch to 14, where pgbench got support for pipeline mode.

Reported-by: Yugo NAGATA <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/20210716153013.fc53b1c780b06fccc07a7f0d@sraoss.co.jp
2023-02-21 10:56:37 +01:00
..
initdb Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_amcheck Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_archivecleanup Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_basebackup Fix various typos in code and tests 2023-02-09 14:43:53 +09:00
pg_checksums Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_config Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_controldata Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ctl Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_dump Fix various typos in code and tests 2023-02-09 14:43:53 +09:00
pg_resetwal Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_rewind Add wait_for_replay_catchup wrapper to Cluster.pm 2023-02-13 11:52:19 +01:00
pg_test_fsync Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_test_timing Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_upgrade Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
pg_verifybackup Add support for progress reporting to pg_verifybackup 2023-02-06 14:40:31 +09:00
pg_waldump Update copyright for 2023 2023-01-02 15:00:37 -05:00
pgbench pgbench: Prepare commands in pipelines in advance 2023-02-21 10:56:37 +01:00
pgevent Update copyright for 2023 2023-01-02 15:00:37 -05:00
psql Zero initialize uses of instr_time about to trigger compiler warnings 2023-01-20 21:16:47 -08:00
scripts Add options to control whether VACUUM runs vac_update_datfrozenxid. 2023-01-06 14:17:25 -05:00
Makefile Update copyright for 2023 2023-01-02 15:00:37 -05:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00