On 5/23/17 13:57, Petr Jelinek wrote:
> On 23/05/17 19:45, Andres Freund wrote:
>>
>>
>> On May 23, 2017 1:42:41 PM EDT, Petr Jelinek <petr.jeli...@2ndquadrant.com> 
>> wrote:
>>> Hi,
>>>
>>> so this didn't really move anywhere AFAICS, do we think the approach
>>> I've chosen is good or do we want to do something else here?
>>
>> Can you add it to the open items list?
>>
> 
> Done

I think the easiest and safest thing to do now is to just prevent
parallel plans in the walsender.  See attached patch.  This prevents the
hang in the select_parallel tests run under your new test setup.

Unifying the signal handling and query processing further seems like a
good idea, but the patches are pretty involved, so I suggest to put them
into the next commit fest.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 26002c4e58647c67cce97e66b34b489bb838e39a Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pete...@gmx.net>
Date: Wed, 31 May 2017 23:27:13 -0400
Subject: [PATCH] Prevent parallel query in walsender

Parallel query in walsender currently hangs, because walsender does not
have the full SIGUSR1 signal handler to handle this.  It's safer and
easier to prevent using a parallel plan for now.  Eventually, the signal
handling in walsender should be unified with regular backends.

Reported-by: Andres Freund <and...@anarazel.de>
---
 src/backend/optimizer/plan/planner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/optimizer/plan/planner.c 
b/src/backend/optimizer/plan/planner.c
index 40cb79d4cd..bb921ba29c 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -50,6 +50,7 @@
 #include "parser/analyze.h"
 #include "parser/parsetree.h"
 #include "parser/parse_agg.h"
+#include "replication/walsender.h"
 #include "rewrite/rewriteManip.h"
 #include "storage/dsm_impl.h"
 #include "utils/rel.h"
@@ -272,6 +273,7 @@ standard_planner(Query *parse, int cursorOptions, 
ParamListInfo boundParams)
         */
        if ((cursorOptions & CURSOR_OPT_PARALLEL_OK) != 0 &&
                IsUnderPostmaster &&
+               !am_walsender &&
                dynamic_shared_memory_type != DSM_IMPL_NONE &&
                parse->commandType == CMD_SELECT &&
                !parse->hasModifyingCTE &&
-- 
2.13.0

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to