Disable force_parallel_mode in libpq_pipeline
authorAlvaro Herrera <[email protected]>
Wed, 31 Mar 2021 21:45:17 +0000 (18:45 -0300)
committerAlvaro Herrera <[email protected]>
Wed, 31 Mar 2021 21:45:25 +0000 (18:45 -0300)
Some buildfarm animals with force_parallel_mode=regress were failing
this test because the error is reported in a parallel worker quicker
than the rows that succeed.

Take the opportunity to move the SET of lc_messages out of the traced
section, because it's not very interesting.

Diagnosed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/3304521.1617221724@sss.pgh.pa.us

src/test/modules/libpq_pipeline/libpq_pipeline.c
src/test/modules/libpq_pipeline/traces/disallowed_in_pipeline.trace
src/test/modules/libpq_pipeline/traces/multi_pipelines.trace
src/test/modules/libpq_pipeline/traces/pipeline_abort.trace
src/test/modules/libpq_pipeline/traces/prepared.trace
src/test/modules/libpq_pipeline/traces/simple_pipeline.trace
src/test/modules/libpq_pipeline/traces/singlerow.trace
src/test/modules/libpq_pipeline/traces/transaction.trace

index 6e136877047b9a46381cb236a73fc15b53626802..081a84f8248dca9e2e3f1681fb5581079245df66 100644 (file)
@@ -438,6 +438,7 @@ test_pipeline_abort(PGconn *conn)
    if (PQresultStatus(res) != PGRES_PIPELINE_SYNC)
        pg_fatal("Unexpected result code %s from pipeline sync",
                 PQresStatus(PQresultStatus(res)));
+   fprintf(stderr, "ok\n");
 
    /* Test single-row mode with an error partways */
    if (PQsendQuery(conn, "SELECT 1.0/g FROM generate_series(3, -1, -1) g") != 1)
@@ -1308,6 +1309,13 @@ main(int argc, char **argv)
        exit_nicely(conn);
    }
 
+   res = PQexec(conn, "SET lc_messages TO \"C\"");
+   if (PQresultStatus(res) != PGRES_COMMAND_OK)
+       pg_fatal("failed to set lc_messages: %s", PQerrorMessage(conn));
+   res = PQexec(conn, "SET force_parallel_mode = off");
+   if (PQresultStatus(res) != PGRES_COMMAND_OK)
+       pg_fatal("failed to set force_parallel_mode: %s", PQerrorMessage(conn));
+
    /* Set the trace file, if requested */
    if (tracefile != NULL)
    {
@@ -1320,10 +1328,6 @@ main(int argc, char **argv)
                        PQTRACE_SUPPRESS_TIMESTAMPS | PQTRACE_REGRESS_MODE);
    }
 
-   res = PQexec(conn, "SET lc_messages TO \"C\"");
-   if (PQresultStatus(res) != PGRES_COMMAND_OK)
-       pg_fatal("failed to set lc_messages: %s", PQerrorMessage(conn));
-
    if (strcmp(testname, "disallowed_in_pipeline") == 0)
        test_disallowed_in_pipeline(conn);
    else if (strcmp(testname, "multi_pipelines") == 0)
index dd8cce4f445181aa6367741cf361fcbc40059e4c..dd6df03f1ed2723a10fbdba31c807463dd19b6d1 100644 (file)
@@ -1,6 +1,3 @@
-F  27  Query    "SET lc_messages TO "C""
-B  8   CommandComplete  "SET"
-B  5   ReadyForQuery    I
 F  13  Query    "SELECT 1"
 B  33  RowDescription   1 "?column?" NNNN 0 NNNN 4 -1 0
 B  11  DataRow  1 1 '1'
index 66ddd9781adb1d90d23c3ed5d9056f2712f4c557..4b9ab07ca42f8053e7d02f50fa9c7c53387eb526 100644 (file)
@@ -1,6 +1,3 @@
-F  27  Query    "SET lc_messages TO "C""
-B  8   CommandComplete  "SET"
-B  5   ReadyForQuery    I
 F  21  Parse    "" "SELECT $1" 1 NNNN
 F  19  Bind     "" "" 0 1 1 '1' 1 0
 F  6   Describe     P ""
index 6aacca03bfa010e71bd9ab65c4c0d2543b9d66d5..b0614357856ca3f48c35ac44a7769c2b619dbf1e 100644 (file)
@@ -1,6 +1,3 @@
-F  27  Query    "SET lc_messages TO "C""
-B  8   CommandComplete  "SET"
-B  5   ReadyForQuery    I
 F  42  Query    "DROP TABLE IF EXISTS pq_pipeline_demo"
 B  123 NoticeResponse   S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_demo" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
 B  15  CommandComplete  "DROP TABLE"
index 2f8ad1bd2a9ac282927baca1763bef8e86b25283..1a7de5c3e65e35da3f711e0eeea961cb0b77c5cd 100644 (file)
@@ -1,6 +1,3 @@
-F  27  Query    "SET lc_messages TO "C""
-B  8   CommandComplete  "SET"
-B  5   ReadyForQuery    I
 F  68  Parse    "select_one" "SELECT $1, '42', $1::numeric, interval '1 sec'" 1 NNNN
 F  16  Describe     S "select_one"
 F  4   Sync
index 54d812a93f4a65c083e94e1b5018c45a018fbc69..5c94749bc1edab27990c1b1401c0465792e15735 100644 (file)
@@ -1,6 +1,3 @@
-F  27  Query    "SET lc_messages TO "C""
-B  8   CommandComplete  "SET"
-B  5   ReadyForQuery    I
 F  21  Parse    "" "SELECT $1" 1 NNNN
 F  19  Bind     "" "" 0 1 1 '1' 1 0
 F  6   Describe     P ""
index 56ce5f80d50e2808d7b7f4f0be318efe18be9643..9de99befcc1f54bab9ff0430151b016eb62bfe6a 100644 (file)
@@ -1,6 +1,3 @@
-F  27  Query    "SET lc_messages TO "C""
-B  8   CommandComplete  "SET"
-B  5   ReadyForQuery    I
 F  38  Parse    "" "SELECT generate_series(42, $1)" 0
 F  20  Bind     "" "" 0 1 2 '44' 1 0
 F  6   Describe     P ""
index 24eb54e4f2a48476bf6a1efe0a8331675ee2160d..0267a534fa1f467dc74dad8e855289f5b566cedd 100644 (file)
@@ -1,6 +1,3 @@
-F  27  Query    "SET lc_messages TO "C""
-B  8   CommandComplete  "SET"
-B  5   ReadyForQuery    I
 F  79  Query    "DROP TABLE IF EXISTS pq_pipeline_tst;CREATE TABLE pq_pipeline_tst (id int)"
 B  122 NoticeResponse   S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_tst" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
 B  15  CommandComplete  "DROP TABLE"