Re: PATCH: Batch/pipelining support for libpq - Mailing list pgsql-hackers

From Zhihong Yu
Subject Re: PATCH: Batch/pipelining support for libpq
Date
Msg-id CALNJ-vTk+Bhtn0gjSS3KO7U+E34uDUfFbXZ6VRexXE-KKrnRNw@mail.gmail.com
Whole thread Raw
In response to Re: PATCH: Batch/pipelining support for libpq  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
Hi,
+       if (querymode == QUERY_SIMPLE)
+       {
+           commandFailed(st, "startpipeline", "cannot use pipeline mode with the simple query protocol");
+           st->state = CSTATE_ABORTED;
+           return CSTATE_ABORTED;

I wonder why the st->state is only assigned for this if block. The state is not set for other cases where CSTATE_ABORTED is returned.

Should PQ_PIPELINE_OFF be returned for the following case ?

+PQpipelineStatus(const PGconn *conn)
+{
+   if (!conn)
+       return false;

Cheers

On Tue, Feb 16, 2021 at 3:14 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
Here's a new version, where I've renamed everything to "pipeline".  I
think the docs could use some additional tweaks now in order to make a
coherent story on pipeline mode, how it can be used in a batched
fashion, etc.

Here's the renames I applied.  It's mostly mechanical, except
PQbatchSendQueue is now PQsendPipeline:

        PQBatchStatus -> PGpipelineStatus (enum)
        PQBATCH_MODE_OFF -> PQ_PIPELINE_OFF
        PQBATCH_MODE_ON -> PQ_PIPELINE_ON
        PQBATCH_MODE_ABORTED -> PQ_PIPELINE_ABORTED
        PQbatchStatus -> PQpipelineStatus (function)
        PQenterBatchMode -> PQenterPipelineMode
        PQexitBatchMode -> PQexitPipelineMode
        PQbatchSendQueue -> PQsendPipeline
        PGRES_BATCH_END -> PGRES_PIPELINE_END
        PGRES_BATCH_ABORTED -> PGRES_PIPELINE_ABORTED

Also, PQbatchStatus(conn) returns enum PGpipelineStatus (it previously
returned int).

I'm tempted to rename PGASYNC_QUEUED to PGASYNC_PIPELINE_IDLE (not sure
if PGASYNC_PIPELINE_READY fits better with the existing one).


In pgbench, I changed the metacommands to be \startpipeline and
\endpipeline.  There's a failing Assert() there which I commented out;
needs fixed.

--
Álvaro Herrera                            39°49'30"S 73°17'W

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: PATCH: Batch/pipelining support for libpq
Next
From: Vik Fearing
Date:
Subject: Re: TRIM_ARRAY