From: Marina Polyakova <m.polyakova@postgrespro.ru>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org, Ildus Kurbangaliev <i.kurbangaliev@postgrespro.ru>
Cc: Teodor Sigaev <teodor@sigaev.ru>
Subject: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Date: Thu, 12 Jul 2018 12:15:42 +0300
Message-ID: <f153ffd55f481d714ee44afc99ecc67e@postgrespro.ru> (raw)
In-Reply-To: <alpine.DEB.2.21.1807112124210.27883@lancre>
References: <20180508193621.dphlgwrd5yz67o2z@alvherre.pgsql>
<0569c5309cf536a839e2a3a1433bd113@postgrespro.ru>
<alpine.DEB.2.21.1807091451520.17811@lancre>
<a6299efa310e1d106144f761259f4fd6@postgrespro.ru>
<alpine.DEB.2.21.1807111435250.27883@lancre>
<976a25a46420c93866ada4051976b1be@postgrespro.ru>
<alpine.DEB.2.21.1807112124210.27883@lancre>
On 11-07-2018 22:34, Fabien COELHO wrote:
>> can we try something like this?
>>
>> PGBENCH_ERROR_START(DEBUG_FAIL)
>> {
>> PGBENCH_ERROR("client %d repeats the failed transaction (try %d",
>
> Argh, no? I was thinking of something much more trivial:
>
> pgbench_error(DEBUG, "message format %d %s...", 12, "hello world");
>
> If you really need some complex dynamic buffer, and I would prefer
> that you avoid that, then the fallback is:
>
> if (level >= DEBUG)
> {
> initPQstuff(&msg);
> ...
> pgbench_error(DEBUG, "fixed message... %s\n", msg);
> freePQstuff(&msg);
> }
>
> The point is to avoid building the message with dynamic allocation and
> so
> if in the end it is not used.
Ok! About avoidance - I'm afraid there's one more piece of debugging
code with the same problem:
else if (command->type == META_COMMAND)
{
...
initPQExpBuffer(&errmsg_buf);
printfPQExpBuffer(&errmsg_buf, "client %d executing \\%s",
st->id, argv[0]);
for (i = 1; i < argc; i++)
appendPQExpBuffer(&errmsg_buf, " %s", argv[i]);
appendPQExpBufferChar(&errmsg_buf, '\n');
ereport(ELEVEL_DEBUG, (errmsg("%s", errmsg_buf.data)));
termPQExpBuffer(&errmsg_buf);
--
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: m.polyakova@postgrespro.ru, coelho@cri.ensmp.fr, alvherre@2ndquadrant.com, i.kurbangaliev@postgrespro.ru, teodor@sigaev.ru
Subject: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
In-Reply-To: <f153ffd55f481d714ee44afc99ecc67e@postgrespro.ru>
* 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