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

Commitfee46ab

Browse files
committed
Fix assertion failure in pgbench when handling multiple pipeline sync messages.
Previously, when running pgbench in pipeline mode with a custom scriptthat triggered retriable errors (e.g., serialization errors),an assertion failure could occur: Assertion failed: (res == ((void*)0)), function discardUntilSync, file pgbench.c, line 3515.The root cause was that pgbench incorrectly assumed only a singlepipeline sync message would be received at the end. In reality,multiple pipeline sync messages can be sent and must be handled properly.This commit fixes the issue by updating pgbench to correctly processmultiple pipeline sync messages, preventing the assertion failure.Back-patch to v15, where the bug was introduced.Author: Fujii Masao <masao.fujii@gmail.com>Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>Discussion:https://postgr.es/m/CAHGQGwFAX56Tfx+1ppo431OSWiLLuW72HaGzZ39NkLkop6bMzQ@mail.gmail.comBackpatch-through: 15
1 parenta3e8dc1 commitfee46ab

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

‎src/bin/pgbench/pgbench.c‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3495,6 +3495,8 @@ doRetry(CState *st, pg_time_usec_t *now)
34953495
staticint
34963496
discardUntilSync(CState*st)
34973497
{
3498+
boolreceived_sync= false;
3499+
34983500
/* send a sync */
34993501
if (!PQpipelineSync(st->con))
35003502
{
@@ -3509,10 +3511,21 @@ discardUntilSync(CState *st)
35093511
PGresult*res=PQgetResult(st->con);
35103512

35113513
if (PQresultStatus(res)==PGRES_PIPELINE_SYNC)
3514+
received_sync= true;
3515+
elseif (received_sync)
35123516
{
3513-
PQclear(res);
3514-
res=PQgetResult(st->con);
3517+
/*
3518+
* PGRES_PIPELINE_SYNC must be followed by another
3519+
* PGRES_PIPELINE_SYNC or NULL; otherwise, assert failure.
3520+
*/
35153521
Assert(res==NULL);
3522+
3523+
/*
3524+
* Reset ongoing sync count to 0 since all PGRES_PIPELINE_SYNC
3525+
* results have been discarded.
3526+
*/
3527+
st->num_syncs=0;
3528+
PQclear(res);
35163529
break;
35173530
}
35183531
PQclear(res);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp