Re: pgbench: allow to exit immediately when any client is aborted

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgbench: allow to exit immediately when any client is aborted
Date: 2023-08-09 05:07:55
Message-ID: 20230809140755.c520663a5a3bfc60b932b5d6@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 9 Aug 2023 13:59:21 +0900
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:

> On Wed, 9 Aug 2023 10:46:38 +0900
> Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:
>
> > On Wed, 9 Aug 2023 02:15:01 +0200 (CEST)
> > Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
> >
> > >
> > > Hello Yugo-san,
> > >
> > > > There are cases where "goto done" is used where some error like
> > > > "invalid socket: ..." happens. I would like to make pgbench exit in
> > > > such cases, too, so I chose to handle errors below the "done:" label.
> > > > However, we can change it to call "exit" instead of "goo done" at each
> > > > place. Do you think this is better?
> > >
> > > Good point.
> > >
> > > Now I understand the "!= FINISHED", because indeed in these cases the done
> > > is reached with unfinished but not necessarily ABORTED clients, and the
> > > comment was somehow misleading.
> > >
> > > On reflection, there should be only one exit() call, thus I'd say to keep
> > > the "goto done" as you did, but to move the checking loop *before* the
> > > disconnect_all, and the overall section comment could be something like
> > > "possibly abort if any client is not finished, meaning some error
> > > occured", which is consistent with the "!= FINISHED" condition.
> >
> > Thank you for your suggestion.
> > I'll fix as above and submit a updated patch soon.
>
> I attached the updated patch v3 including changes above, a test,
> and fix of the typo you pointed out.

I'm sorry but the test in the previous patch was incorrect.
I attached the correct one.

Regards,
Yugo Nagata

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

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

Attachment Content-Type Size
v3-pgbench_exit_on_abort.patch text/x-diff 6.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-08-09 05:29:31 Re: Handle infinite recursion in logical replication setup
Previous Message Noah Misch 2023-08-09 05:04:36 Re: 2023-08-10 release announcement draft