Re: PATCH: Batch/pipelining support for libpq

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Vaishnavi Prabakaran" <vaishnaviprabakaran(at)gmail(dot)com>
Cc: "Michael Paquier" <michael(dot)paquier(at)gmail(dot)com>,"Prabakaran, Vaishnavi" <VaishnaviP(at)fast(dot)au(dot)fujitsu(dot)com>,"Craig Ringer" <craig(at)2ndquadrant(dot)com>,"Haribabu Kommi" <kommi(dot)haribabu(at)gmail(dot)com>,"Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>,"Dmitry Igrishin" <dmitigr(at)gmail(dot)com>,"Andres Freund" <andres(at)anarazel(dot)de>,"PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>,"Manuel Kniep" <m(dot)kniep(at)web(dot)de>,"fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp" <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>,"Iwata, Aya" <iwata(dot)aya(at)jp(dot)fujitsu(dot)com>
Subject: Re: PATCH: Batch/pipelining support for libpq
Date: 2017-03-16 13:37:03
Message-ID: 2852bbcc-30af-4997-8e66-83b8351b3bd4@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Vaishnavi Prabakaran wrote:

> So, attached the alternative fix for this issue.
> Please share me your thoughts.

I assume you prefer the alternative fix because it's simpler.

> I would also like to hear Craig's opinion on it before applying this fix
> to the original patch, just to make sure am not missing anything here.

+1

The main question is whether the predicates enforced
by PQsetSingleRowMode() apply in batch mode in all cases
when it's legit to call that function. Two predicates
that may be problematic are:
if (conn->asyncStatus != PGASYNC_BUSY)
return 0;
and
if (conn->result)
return 0;

The general case with batch mode is that, from the doc:
"The client interleaves result processing with sending batch queries"
Note that I've not even tested that here, I've tested
batching a bunch of queries in a first step and getting the results
in a second step.
I am not confident that the above predicates will be true
in all cases. Also your alternative fix assumes that we add
a user-visible exception to PQsetSingleRowMode in batch mode,
whereby it must not be called as currently documented:
"call PQsetSingleRowMode immediately after a successful call of
PQsendQuery (or a sibling function)"
My gut feeling is that it's not the right direction, I prefer making
the single-row a per-query attribute internally and keep
PQsetSingleRowMode's contract unchanged from the
user's perspective.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2017-03-16 13:52:45 Re: scram and \password
Previous Message Bruce Momjian 2017-03-16 13:31:23 Re: Should we eliminate or reduce HUP from docs?