summaryrefslogtreecommitdiffstats
path: root/src/bin/pgbench
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:18:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:18:09 +0000
commitebe124eacd7c3faa36ed358e7cc1d7c5b419e5f6 (patch)
tree48fe9c3270176faa25c7d9fb47326f689be82fe4 /src/bin/pgbench
parentReleasing progress-linux version 15.5-0+deb12u1~progress6.99u1. (diff)
downloadpostgresql-15-ebe124eacd7c3faa36ed358e7cc1d7c5b419e5f6.tar.xz
postgresql-15-ebe124eacd7c3faa36ed358e7cc1d7c5b419e5f6.zip
Merging upstream version 15.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bin/pgbench')
-rw-r--r--src/bin/pgbench/pgbench.c15
-rw-r--r--src/bin/pgbench/t/001_pgbench_with_server.pl30
2 files changed, 42 insertions, 3 deletions
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 895afcb..e5ee1a0 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -3778,10 +3778,21 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg)
case CSTATE_START_COMMAND:
command = sql_script[st->use_file].commands[st->command];
- /* Transition to script end processing if done */
+ /*
+ * Transition to script end processing if done, but close up
+ * shop if a pipeline is open at this point.
+ */
if (command == NULL)
{
- st->state = CSTATE_END_TX;
+ if (PQpipelineStatus(st->con) == PQ_PIPELINE_OFF)
+ st->state = CSTATE_END_TX;
+ else
+ {
+ pg_log_error("client %d aborted: end of script reached with pipeline open",
+ st->id);
+ st->state = CSTATE_ABORTED;
+ }
+
break;
}
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index 027c513..85eb5bc 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -841,9 +841,37 @@ select 1 \gset f
}
});
+# Try \startpipeline without \endpipeline in a single transaction
+$node->pgbench(
+ '-t 1 -n -M extended',
+ 2,
+ [],
+ [qr{end of script reached with pipeline open}],
+ 'error: call \startpipeline without \endpipeline in a single transaction',
+ {
+ '001_pgbench_pipeline_5' => q{
+-- startpipeline only with single transaction
+\startpipeline
+}
+ });
+
+# Try \startpipeline without \endpipeline
+$node->pgbench(
+ '-t 2 -n -M extended',
+ 2,
+ [],
+ [qr{end of script reached with pipeline open}],
+ 'error: call \startpipeline without \endpipeline',
+ {
+ '001_pgbench_pipeline_6' => q{
+-- startpipeline only
+\startpipeline
+}
+ });
+
# Working \startpipeline in prepared query mode with serializable
$node->pgbench(
- '-c4 -j2 -t 10 -n -M prepared',
+ '-c4 -t 10 -n -M prepared',
0,
[
qr{type: .*/001_pgbench_pipeline_serializable},