Re: pgbench tap tests & minor fixes

From: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: pgbench tap tests & minor fixes
Date: 2017-05-08 20:40:41
Message-ID: 24497850.I7ORQLQ1Cr@x200m
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-05-08 20:55:36 Re: logical replication syntax (was DROP SUBSCRIPTION, query cancellations and slot handling)
Previous Message Fabien COELHO 2017-05-08 20:08:51 Re: pgbench tap tests & minor fixes