Fix a couple of bugs in recent parallelism-related commits.
authorRobert Haas <rhaas@postgresql.org>
Thu, 22 Oct 2015 14:49:20 +0000 (10:49 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 22 Oct 2015 14:49:20 +0000 (10:49 -0400)
Commit 816e336f12ecabdc834d4cc31bcf966b2dd323dc added the wrong error
check to async.c; sending restrictions is restricted to the leader,
not altogether unsafe.

Commit 3bd909b220930f21d6e15833a17947be749e7fde added ExecShutdownNode
to traverse the planstate tree and call shutdown functions, but made
a Gather node, the only node that actually has such a function, abort
the tree traversal, which is wrong.

src/backend/commands/async.c
src/backend/executor/execProcnode.c

index 3657d693bf8f2a114385ce0a10f490d601e3e578..5059e3de9276d739b3093f196ac30ecd12b5137e 100644 (file)
 #include <unistd.h>
 #include <signal.h>
 
+#include "access/parallel.h"
 #include "access/slru.h"
 #include "access/transam.h"
 #include "access/xact.h"
@@ -544,8 +545,8 @@ Async_Notify(const char *channel, const char *payload)
        Notification *n;
        MemoryContext oldcontext;
 
-       if (IsInParallelMode())
-               elog(ERROR, "cannot send notifications during a parallel operation");
+       if (IsParallelWorker())
+               elog(ERROR, "cannot send notifications from a parallel worker");
 
        if (Trace_notify)
                elog(DEBUG1, "Async_Notify(%s)", channel);
index 5bc1d489421242298c759142fbd4307aa9b0b21b..6f5c5545c9205c6d4ed58259ecd0a3535194a0b0 100644 (file)
@@ -804,10 +804,7 @@ ExecShutdownNode(PlanState *node)
        switch (nodeTag(node))
        {
                case T_GatherState:
-                       {
-                               ExecShutdownGather((GatherState *) node);
-                               return true;
-                       }
+                       ExecShutdownGather((GatherState *) node);
                        break;
                default:
                        break;