Re: Using PQexecQuery in pipeline mode produces unexpected Close messages

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, daniele(dot)varrazzo(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Using PQexecQuery in pipeline mode produces unexpected Close messages
Date: 2022-07-04 08:49:33
Message-ID: 20220704084933.zi5ejy54ffdm2xlw@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 2022-Jul-04, Kyotaro Horiguchi wrote:

> At Wed, 29 Jun 2022 14:09:17 +0200, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote in

> > However, another problem case, not fixed by PIPELINE_IDLE, occurs if you
> > exit pipeline mode after PQsendQuery() and then immediately use
> > PQexec(). The CloseComplete will be received at the wrong time, and a
> > notice is emitted nevertheless.
>
> Mmm. My patch moves the point of failure of the scenario a bit but
> still a little short. However, as my understanding, it seems like the
> task of the PQpipelineSync()-PQgetResult() pair to consume the
> CloseComplete. If Iinserted PQpipelineSync() just after PQsendQuery()
> and called PQgetResult() for PGRES_PIPELINE_SYNC before
> PQexitPipelineMode(), the out-of-sync CloseComplete is not seen in the
> scenario. But if it is right, I'd like to complain about the
> obscure-but-stiff protocol of pipleline mode..

Yeah, if you introduce PQpipelineSync then I think it'll work okay, but
my point here was to make it work without requiring that; that's why I
wrote the test to use PQsendFlushRequest instead.

BTW I patch for the problem with uniqviol also (not fixed by v7). I'll
send an updated patch in a little while.

> > I produced pipeline_idle.trace file by running the test in the fully
>
> By the perl script doesn't produce the trace file since the list in
> $cmptrace line doesn't contain pipleline_idle..

Ouch, of course, thanks for noticing.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2022-07-04 09:32:38 Re: Using PQexecQuery in pipeline mode produces unexpected Close messages
Previous Message Kyotaro Horiguchi 2022-07-04 08:27:44 Re: Using PQexecQuery in pipeline mode produces unexpected Close messages

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-07-04 09:27:53 Re: Emit extra debug message when executing extension script.
Previous Message shiy.fnst@fujitsu.com 2022-07-04 08:41:17 RE: Handle infinite recursion in logical replication setup