1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Fix oversight in commit 1ec7fca859.

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
This commit is contained in:
Etsuro Fujita
2021-08-02 12:45:00 +09:00
parent eaf5321c35
commit a8ed9bd59d
2 changed files with 29 additions and 13 deletions

View File

@ -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;
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);
/* Do the actual work. */
ExecAsyncNotify(areq);
}
}
}
}