From: Fabien COELHO <coelho@cri.ensmp.fr>
To: nuko yokohama <nuko.yokohama@gmail.com>
Cc: PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: Problem in using pgbench's --connect(-C) and --rate=rate(-R rate) options together.
Date: Wed, 25 Jan 2017 18:59:45 +0100 (CET)
Message-ID: <alpine.DEB.2.20.1701251529050.2871@lancre> (raw)
In-Reply-To: <alpine.DEB.2.20.1701251519510.2871@lancre>
References: <CAF3Gu1b+6k6uWiqXEpp9NevNbQfPDMEeobXbYupwdS0NY6HJJw@mail.gmail.com>
<alpine.DEB.2.20.1701251519510.2871@lancre>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
>> It operates normally when only the -C option or only the -R option is
>> specified.
>>
>> In the PostgreSQL document, It is not described that "these two options can
>> not be specified at the same time ". Is this a problem of pgbench?
>
> Yes, indeed there is. Thanks for the report. Option -C is seldom used and
> tested.
The problem is already fixed in head. Looking at git log, it was unclear
to guess which change fixed that... After another reading, I got it in
one, it has been fixed by Heikki restructuring patch
12788ae49e1933f463bc59a6efe46c4a01701b76 which has no vocation to be
backpatched to prior versions...
The bug is that prior to --rate doCustom was always disconnect/reconnect
without exiting, but with rate it returns if it has to wait. However
threadRun test whether there is a connection before recalling doCustom, so
it was never called.
This is exactly the kind of unmanageable state combination that
refactoring has cleaned up.
Attached a small patch which fixes the issue, I think, in 9.6.
Fixing it raised another issue wrt to some stats under -C, that I fixed as
well.
--
Fabien.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugsAttachments:pgbench-CR-bug-1.patch (text/x-diff, 731B) downloaddiff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.cindex 531671a..1f1b7bf 100644--- a/src/bin/pgbench/pgbench.c+++ b/src/bin/pgbench/pgbench.c@@ -1967,7 +1967,6 @@ top:
st->listen = false;
st->sleeping = false;
st->throttling = false;
- st->is_throttled = false;
memset(st->prepared, 0, sizeof(st->prepared));
}
@@ -4345,6 +4344,12 @@ threadRun(void *arg)
remains--; /* I've aborted */
}
}
+ else if (is_connect && st->sleeping)+ {+ /* it is sleeping for throttling, maybe it is done, let us try */+ if (!doCustom(thread, st, &aggs))+ remains--;+ }
if (st->ecnt > prev_ecnt && commands[st->state]->type == META_COMMAND)
{
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: coelho@cri.ensmp.fr, nuko.yokohama@gmail.com
Subject: Re: Problem in using pgbench's --connect(-C) and --rate=rate(-R rate) options together.
In-Reply-To: <alpine.DEB.2.20.1701251529050.2871@lancre>
References: <CAF3Gu1b+6k6uWiqXEpp9NevNbQfPDMEeobXbYupwdS0NY6HJJw@mail.gmail.com> <alpine.DEB.2.20.1701251519510.2871@lancre> <alpine.DEB.2.20.1701251529050.2871@lancre>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox