Re: Using PQexecQuery in pipeline mode produces unexpected Close messages
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: tgl@sss.pgh.pa.us, daniele.varrazzo@gmail.com, pgsql-hackers@lists.postgresql.org
Date: 2022-07-04T08:49:33Z
Lists: pgsql-bugs, pgsql-hackers
On 2022-Jul-04, Kyotaro Horiguchi wrote: > At Wed, 29 Jun 2022 14:09:17 +0200, Alvaro Herrera <alvherre@alvh.no-ip.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/
Commits
-
001_libpq_pipeline.pl: use Test::Differences if available
- 87e4f24d8293 16.0 landed
-
libpq: Improve idle state handling in pipeline mode
- 93cf9233cd54 15.0 landed
- 7c1f42612384 14.5 landed
- 054325c5eeb3 16.0 landed