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

From Daniel Verite
Subject Re: PATCH: Batch/pipelining support for libpq
Date
Msg-id 5f3810de-df50-49a2-82fa-b95111ef2bbd@manitou-mail.org
Whole thread Raw
In response to PATCH: Batch/pipelining support for libpq  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
Michael Paquier wrote:

> # Running: testlibpqbatch dbname=postgres 10000 copyfailure
> dispatching SELECT query failed: cannot queue commands during COPY
>
> COPYBUF: 5
>
> Error status and message got from server due to COPY command failure
> are : PGRES_FATAL_ERROR ERROR:  unexpected message type 0x50 during
> COPY from stdin
> CONTEXT:  COPY batch_demo, line 1

Same result here.

BTW the doc says:  "In batch mode only asynchronous operations are permitted, and COPY is  not recommended as it most
likelywill trigger failure in batch 
processing"
Yet it seems that the test assumes that it should work nonetheless.
I don't quite understand what we expect of this test, given what's
documented. Or what am I missing?

While looking at the regress log, I noticed multiple spurious
test_singlerowmode tests among the others. Should be fixed with:

--- a/src/test/modules/test_libpq/testlibpqbatch.c
+++ b/src/test/modules/test_libpq/testlibpqbatch.c
@@ -1578,6 +1578,7 @@ main(int argc, char **argv)        run_batch_abort = 0;        run_timings = 0;
run_copyfailure= 0; 
+            run_singlerowmode = 0;        if (strcmp(argv[3], "disallowed_in_batch") == 0)
run_disallowed_in_batch= 1;        else if (strcmp(argv[3], "simple_batch") == 0) 

There's also the fact that this test doesn't care whether it fails
(compare with all the "goto fail" of the other tests).

And it happens that PQsetSingleRowMode() fails after the call to
PQbatchQueueProcess() that instantiates a PGresult
of status PGRES_BATCH_END to indicate the end of the batch,

To me this shows how this way of setting the single row mode is not ideal.
In order to avoid the failure, the loop should know in advance
what kind of result it's going to dequeue before calling PQgetResult(),
which doesn't feel right.


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



pgsql-hackers by date:

Previous
From: tushar
Date:
Subject: Getting server crash after running sqlsmith
Next
From: Amit Kapila
Date:
Subject: Re: Patch: Write Amplification Reduction Method (WARM)