Re: Suggestion to add --continue-client-on-abort option to pgbench

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Rintaro Ikeda <ikedarintarof(at)oss(dot)nttdata(dot)com>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "slpmcf(at)gmail(dot)com" <slpmcf(at)gmail(dot)com>, "boekewurm+postgres(at)gmail(dot)com" <boekewurm+postgres(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: Suggestion to add --continue-client-on-abort option to pgbench
Date: 2025-11-12 09:33:46
Message-ID: 20251112183346.83f98eaa0b5e4674b1735b3f@sraoss.co.jp
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 12 Nov 2025 00:20:15 +0900
Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:

> On Tue, Nov 11, 2025 at 10:50 AM Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
> > I've attached a patch to fix this.
>
> Thanks for reporting the issue and providing the patch!
>
> > If a PGRES_PIPELINE_SYNC is followed by something other than PGRES_PIPELINE_SYNC or NULL,
> > it means that another PGRES_PIPELINE_SYNC will eventually follow after some other results.
> > In this case, we should reset the receive_sync flag and continue discarding results.
>
> Yes.
>
> + if (res)
> + {
> + received_sync = false;
> + continue;
>
> Shouldn't we also call PQclear(res) here? For example:

Thank you for your review!
Yes, we need PQclear() here.

I've attached an updated patch.

The comment for the PQpipelineSync() call has been also updated to clarify
why it is necessary.

In addition, I added a connection status check in the loop to avoid an
infinte loop that waiting for PQpipelineSync after a connection failure.

I packed these changes in the same patch, but they can be split into separate
patches.

What do you think?

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
v2-0001-pgbench-Fix-assertion-failure-with-multiple-syncp.patch text/x-diff 3.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2025-11-12 09:34:17 Re: Suggestion to add --continue-client-on-abort option to pgbench
Previous Message Chao Li 2025-11-12 09:31:53 Re: SQL:2011 Application Time Update & Delete