Re: Pipeline mode and PQpipelineSync()
Alvaro Herrera <alvaro.herrera@2ndquadrant.com>
From: Alvaro Herrera <alvaro.herrera@2ndquadrant.com>
To: Boris Kolpackov <boris@codesynthesis.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2021-06-29T13:54:49Z
Lists: pgsql-hackers
On 2021-Jun-24, Boris Kolpackov wrote: > I've hit another similar case except now an unexpected NULL result is > returned in the middle of PGRES_PIPELINE_ABORTED result sequence. The > call sequence is as follows: > > PQsendQueryPrepared() # INSERT #1 > PQflush() > PQsendQueryPrepared() # INSERT #2 > PQflush() > ... > PQsendQueryPrepared() # INSERT #251 -- insert duplicate PK > PQflush() > ... > PQsendQueryPrepared() # INSERT #343 > PQflush() > PQconsumeInput() # At this point select() indicates we can read. > PQgetResult() # NULL -- unexpected but skipped (see prev. email) > PQgetResult() # INSERT #1 > PQgetResult() # NULL > PQgetResult() # INSERT #2 > PQgetResult() # NULL > ... > PQgetResult() # INSERT #251 error result, SQLSTATE 23505 > PQgetResult() # NULL > PQgetResult() # INSERT #252 PGRES_PIPELINE_ABORTED > PQgetResult() # NULL > PQgetResult() # INSERT #253 PGRES_PIPELINE_ABORTED > PQgetResult() # NULL > ... > PQgetResult() # INSERT #343 NULL (???) > > Notice that result #343 corresponds to the last PQsendQueryPrepared() > call made before the socket became readable (it's not always 343 but > around there). No luck reproducing any problems with this sequence as yet. -- Álvaro Herrera 39°49'30"S 73°17'W
Commits
-
libpq: Fix sending queries in pipeline aborted state
- ab0967942900 15.0 landed
- 1beaa654da61 14.0 landed
-
Fix libpq state machine in pipeline mode
- b71a9cb31e46 15.0 landed
- 690339fcd587 14.0 landed
-
Add PQsendFlushRequest to libpq
- a7192326c74d 15.0 landed
- 69cf1d5429d4 14.0 landed