aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAppend.c
diff options
context:
space:
mode:
authorEtsuro Fujita <efujita@postgresql.org>2021-08-02 12:45:01 +0900
committerEtsuro Fujita <efujita@postgresql.org>2021-08-02 12:45:01 +0900
commitfb234086fe81fb1848934b6e1f6382611fc9ad4f (patch)
treeefdef28948bf4ac7f5ec6783ac1c636535eb0f52 /src/backend/executor/nodeAppend.c
parentec410c985e6d360f666e39be5609f3c4da5edc8f (diff)
downloadpostgresql-fb234086fe81fb1848934b6e1f6382611fc9ad4f.tar.gz
postgresql-fb234086fe81fb1848934b6e1f6382611fc9ad4f.zip
Fix oversight in commit 1ec7fca8592178281cd5cdada0f27a340fb813fc.
I failed to account for the possibility that when ExecAppendAsyncEventWait() notifies multiple async-capable nodes using postgres_fdw, a preceding node might invoke process_pending_request() to process a pending asynchronous request made by a succeeding node. In that case the succeeding node should produce a tuple to return to the parent Append node from tuples fetched by process_pending_request() when notified. Repair. Per buildfarm via Michael Paquier. Back-patch to v14, like the previous commit. Thanks to Tom Lane for testing. Discussion: https://postgr.es/m/YQP0UPT8KmPiHTMs%40paquier.xyz
Diffstat (limited to 'src/backend/executor/nodeAppend.c')
-rw-r--r--src/backend/executor/nodeAppend.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index a4eef19d7f4..6a2daa6e767 100644
--- a/src/backend/executor/nodeAppend.c
+++ b/src/backend/executor/nodeAppend.c
@@ -1082,16 +1082,18 @@ ExecAppendAsyncEventWait(AppendState *node)
{
AsyncRequest *areq = (AsyncRequest *) w->user_data;
- /*
- * Mark it as no longer needing a callback. We must do this
- * before dispatching the callback in case the callback resets the
- * flag.
- */
- Assert(areq->callback_pending);
- areq->callback_pending = false;
-
- /* Do the actual work. */
- ExecAsyncNotify(areq);
+ if (areq->callback_pending)
+ {
+ /*
+ * Mark it as no longer needing a callback. We must do this
+ * before dispatching the callback in case the callback resets
+ * the flag.
+ */
+ areq->callback_pending = false;
+
+ /* Do the actual work. */
+ ExecAsyncNotify(areq);
+ }
}
}
}