Re: [Review] pgbench duration option - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: [Review] pgbench duration option
Date
Msg-id 37ed240d0809050845x73789ba7m725d10d976958293@mail.gmail.com
Whole thread Raw
In response to Re: pgbench duration option  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: [Review] pgbench duration option  (ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
List pgsql-hackers
Hello again,

I received the following email from a helpful fellow off-list,
pointing out an error in my review:

On Fri, Sep 5, 2008 at 7:03 PM, Ragnar <gnari@hive.is> wrote:
> On fös, 2008-09-05 at 15:07 +1000, Brendan Jurd wrote:
>> Wouldn't this be better written as:
>>
>>                       if ((duration > 0 && timer_exceeded) || st->cnt >= nxacts)
>>                       {
>>                               <stop>
>>                       }
>
> sorry, but these do not lok as the same thing to me.
>
> in the first variant there will not be a stop if
>  (duration > 0) and NOT (timer_exceeded) and (st->cnt >= nxacts)
> but in the second variant there will.
>
> admittedly, i have no idea if that situation can occur.
>
> gnari
>

gnari is right.  Looking closer I see that nxacts defaults to 10 in
the absence of a -t option, so my version of the code would end up
stopping when the run reaches 10 transactions, even if the user has
specified a -T option.

Sorry for the error.  The (duration > 0) test does in fact need to be separate.

Thanks for the catch, gnari.

Cheers,
BJ


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: plpgsql is not translate-aware
Next
From: Alvaro Herrera
Date:
Subject: Re: plpgsql is not translate-aware