Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f96d11

Browse files
author
Etsuro Fujita
committed
Fix bogus coding in ExecAppendAsyncEventWait().
No configured-by-FDW events would result in "return" directly out of aPG_TRY block, making the exception stack dangling. Repair.Oversight in commit501cfd0; back-patch to v14, like that commit, butas we do not have this issue in HEAD (cf. commit50c67c2), no need toapply this patch to it.In passing, improve a comment about the handling of in-process requestsin a postgres_fdw.c function called from this function.Alexander Pyhalov, with comment adjustment/improvement by me.Discussion:https://postgr.es/m/425fa29a429b21b0332737c42a4fdc70%40postgrespro.ru
1 parentc2faf48 commit3f96d11

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

‎contrib/postgres_fdw/postgres_fdw.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6968,14 +6968,16 @@ postgresForeignAsyncConfigureWait(AsyncRequest *areq)
69686968
{
69696969
/*
69706970
* This is the case when the in-process request was made by another
6971-
* Append. Note that it might be useless to process the request,
6972-
* because the query might not need tuples from that Append anymore.
6973-
* If there are any child subplans of the same parent that are ready
6974-
* for new requests, skip the given request. Likewise, if there are
6975-
* any configured events other than the postmaster death event, skip
6976-
* it. Otherwise, process the in-process request, then begin a fetch
6977-
* to configure the event below, because we might otherwise end up
6978-
* with no configured events other than the postmaster death event.
6971+
* Append. Note that it might be useless to process the request made
6972+
* by that Append, because the query might not need tuples from that
6973+
* Append anymore; so we avoid processing it to begin a fetch for the
6974+
* given request if possible. If there are any child subplans of the
6975+
* same parent that are ready for new requests, skip the given
6976+
* request. Likewise, if there are any configured events other than
6977+
* the postmaster death event, skip it. Otherwise, process the
6978+
* in-process request, then begin a fetch to configure the event
6979+
* below, because we might otherwise end up with no configured events
6980+
* other than the postmaster death event.
69796981
*/
69806982
if (!bms_is_empty(requestor->as_needrequest))
69816983
return;

‎src/backend/executor/nodeAppend.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,26 +1034,25 @@ ExecAppendAsyncEventWait(AppendState *node)
10341034
}
10351035

10361036
/*
1037-
*No need for further processing ifthere are no configured events
1038-
*other than the postmaster death event.
1037+
*Ifthere are no configured events other than the postmaster death
1038+
*event, we don't need to wait or poll.
10391039
*/
10401040
if (GetNumRegisteredWaitEvents(node->as_eventset)==1)
1041+
noccurred=0;
1042+
else
10411043
{
1042-
FreeWaitEventSet(node->as_eventset);
1043-
node->as_eventset=NULL;
1044-
return;
1045-
}
1044+
/* Return at most EVENT_BUFFER_SIZE events in one call. */
1045+
if (nevents>EVENT_BUFFER_SIZE)
1046+
nevents=EVENT_BUFFER_SIZE;
10461047

1047-
/* Return at most EVENT_BUFFER_SIZE events in one call. */
1048-
if (nevents>EVENT_BUFFER_SIZE)
1049-
nevents=EVENT_BUFFER_SIZE;
1050-
1051-
/*
1052-
* If the timeout is -1, wait until at least one event occurs. If the
1053-
* timeout is 0, poll for events, but do not wait at all.
1054-
*/
1055-
noccurred=WaitEventSetWait(node->as_eventset,timeout,occurred_event,
1056-
nevents,WAIT_EVENT_APPEND_READY);
1048+
/*
1049+
* If the timeout is -1, wait until at least one event occurs. If
1050+
* the timeout is 0, poll for events, but do not wait at all.
1051+
*/
1052+
noccurred=WaitEventSetWait(node->as_eventset,timeout,
1053+
occurred_event,nevents,
1054+
WAIT_EVENT_APPEND_READY);
1055+
}
10571056
}
10581057
PG_FINALLY();
10591058
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp