Skip to content

Commit bde39ee

Browse files
committed
Fix a couple of bugs in recent parallelism-related commits.
Commit 816e336 added the wrong error check to async.c; sending restrictions is restricted to the leader, not altogether unsafe. Commit 3bd909b 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.
1 parent 1a219fa commit bde39ee

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/backend/commands/async.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
#include <unistd.h>
118118
#include <signal.h>
119119

120+
#include "access/parallel.h"
120121
#include "access/slru.h"
121122
#include "access/transam.h"
122123
#include "access/xact.h"
@@ -544,8 +545,8 @@ Async_Notify(const char *channel, const char *payload)
544545
Notification *n;
545546
MemoryContext oldcontext;
546547

547-
if (IsInParallelMode())
548-
elog(ERROR, "cannot send notifications during a parallel operation");
548+
if (IsParallelWorker())
549+
elog(ERROR, "cannot send notifications from a parallel worker");
549550

550551
if (Trace_notify)
551552
elog(DEBUG1, "Async_Notify(%s)", channel);

src/backend/executor/execProcnode.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -804,10 +804,7 @@ ExecShutdownNode(PlanState *node)
804804
switch (nodeTag(node))
805805
{
806806
case T_GatherState:
807-
{
808-
ExecShutdownGather((GatherState *) node);
809-
return true;
810-
}
807+
ExecShutdownGather((GatherState *) node);
811808
break;
812809
default:
813810
break;

0 commit comments

Comments
 (0)