Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85ecff8

Browse files
committed
Abort pgbench if script end is reached with an open pipeline
When a pipeline is opened with \startpipeline and not closed, pgbenchwill either error on the next transaction with a "already in pipelinemode" error or successfully end if this was the last transaction --despite not sending anything that was piped in the pipeline.Make it an error to reach end of script is reached while there's anopen pipeline.Backpatch to 14, where pgbench got support for pipelines.Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>Reported-by: Michael Paquier <michael@paquier.xyz>Discussion:https://postgr.es/m/Za4IObZkDjrO4TcS@paquier.xyz
1 parentb7e8f27 commit85ecff8

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3337,10 +3337,21 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg)
33373337
caseCSTATE_START_COMMAND:
33383338
command=sql_script[st->use_file].commands[st->command];
33393339

3340-
/* Transition to script end processing if done */
3340+
/*
3341+
* Transition to script end processing if done, but close up
3342+
* shop if a pipeline is open at this point.
3343+
*/
33413344
if (command==NULL)
33423345
{
3343-
st->state=CSTATE_END_TX;
3346+
if (PQpipelineStatus(st->con)==PQ_PIPELINE_OFF)
3347+
st->state=CSTATE_END_TX;
3348+
else
3349+
{
3350+
pg_log_error("client %d aborted: end of script reached with pipeline open",
3351+
st->id);
3352+
st->state=CSTATE_ABORTED;
3353+
}
3354+
33443355
break;
33453356
}
33463357

‎src/bin/pgbench/t/001_pgbench_with_server.pl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,34 @@
828828
}
829829
});
830830

831+
# Try \startpipeline without \endpipeline in a single transaction
832+
$node->pgbench(
833+
'-t 1 -n -M extended',
834+
2,
835+
[],
836+
[qr{end of script reached with pipeline open}],
837+
'error: call \startpipeline without \endpipeline in a single transaction',
838+
{
839+
'001_pgbench_pipeline_5'=>q{
840+
-- startpipeline only with single transaction
841+
\startpipeline
842+
}
843+
});
844+
845+
# Try \startpipeline without \endpipeline
846+
$node->pgbench(
847+
'-t 2 -n -M extended',
848+
2,
849+
[],
850+
[qr{end of script reached with pipeline open}],
851+
'error: call \startpipeline without \endpipeline',
852+
{
853+
'001_pgbench_pipeline_6'=>q{
854+
-- startpipeline only
855+
\startpipeline
856+
}
857+
});
858+
831859
# Working \startpipeline in prepared query mode with serializable
832860
$node->pgbench(
833861
'-c4 -t 10 -n -M prepared',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp