В письме от 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.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to