Re: [HACKERS] pgbench tap tests & minor fixes - Mailing list pgsql-hackers

From Nikolay Shaplov
Subject Re: [HACKERS] pgbench tap tests & minor fixes
Date
Msg-id 24497850.I7ORQLQ1Cr@x200m
Whole thread Raw
In response to Re: [HACKERS] pgbench tap tests & minor fixes  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: [HACKERS] pgbench tap tests & minor fixes  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
В письме от 8 мая 2017 22:08:51 пользователь Fabien COELHO написал:

> >                    while (thread->throttle_trigger < now_us -
> >                    latency_limit &&
> >
> >                           /* with -t, do not overshoot */
> >                           (nxacts <= 0 || st->cnt < nxacts))
>
>                          ...
>
> >                    if (nxacts > 0 && st->cnt >= nxacts)
> >                    {
> >
> >                        st->state = CSTATE_FINISHED;
> >                        break;
> >
> >                    }
> >

st->cnt -- number of transactions finished successed or failed, right?

one iteration of for(;;) is for one transaction or really less. Right? We
can't process two tansactions in one iteration of this loop. So  we can't
increase st->cnt more then once during one iteration?


So let's look at the while loop:
                  while (thread->throttle_trigger < now_us - latency_limit
&&                          /* with -t, do not overshoot */                          (nxacts <= 0 || st->cnt < nxacts))
                 {                       processXactStats(thread, st, &now, true, agg);                       /* next
rendez-vous*/                       wait = getPoissonRand(thread, throttle_delay);
thread->throttle_trigger+= wait;                       st->txn_scheduled = thread->throttle_trigger;
}


Let's imagine that thread->throttle_trigger is  now_us - 10 000,
latency_limit is 5 000 and throttle_delay is 100

How many times you would call  processXactStats in this while loop?
And each time it would do st->cnt++

And this while loop is inside for(;;) in which as I said above we can do st-
>cnt++ not more than once. I see no logic here.


PS This is a fast reply. May be it will make things clear fast wither for me
or for you. I will carefully answer your full letter tomorrow (I hope nothing
will prevent me from doing it)

--
Nikolay Shaplov, independent Perl & C/C++ developer. Available for hire.



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] pgbench tap tests & minor fixes
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] logical replication syntax (was DROP SUBSCRIPTION,query cancellations and slot handling)