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

Commitf6f61a4

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 parentbafad43 commitf6f61a4

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
@@ -7174,14 +7174,16 @@ postgresForeignAsyncConfigureWait(AsyncRequest *areq)
71747174
{
71757175
/*
71767176
* This is the case when the in-process request was made by another
7177-
* Append. Note that it might be useless to process the request,
7178-
* because the query might not need tuples from that Append anymore.
7179-
* If there are any child subplans of the same parent that are ready
7180-
* for new requests, skip the given request. Likewise, if there are
7181-
* any configured events other than the postmaster death event, skip
7182-
* it. Otherwise, process the in-process request, then begin a fetch
7183-
* to configure the event below, because we might otherwise end up
7184-
* with no configured events other than the postmaster death event.
7177+
* Append. Note that it might be useless to process the request made
7178+
* by that Append, because the query might not need tuples from that
7179+
* Append anymore; so we avoid processing it to begin a fetch for the
7180+
* given request if possible. If there are any child subplans of the
7181+
* same parent that are ready for new requests, skip the given
7182+
* request. Likewise, if there are any configured events other than
7183+
* the postmaster death event, skip it. Otherwise, process the
7184+
* in-process request, then begin a fetch to configure the event
7185+
* below, because we might otherwise end up with no configured events
7186+
* other than the postmaster death event.
71857187
*/
71867188
if (!bms_is_empty(requestor->as_needrequest))
71877189
return;

‎src/backend/executor/nodeAppend.c

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

10451045
/*
1046-
*No need for further processing ifthere are no configured events
1047-
*other than the postmaster death event.
1046+
*Ifthere are no configured events other than the postmaster death
1047+
*event, we don't need to wait or poll.
10481048
*/
10491049
if (GetNumRegisteredWaitEvents(node->as_eventset)==1)
1050+
noccurred=0;
1051+
else
10501052
{
1051-
FreeWaitEventSet(node->as_eventset);
1052-
node->as_eventset=NULL;
1053-
return;
1054-
}
1053+
/* Return at most EVENT_BUFFER_SIZE events in one call. */
1054+
if (nevents>EVENT_BUFFER_SIZE)
1055+
nevents=EVENT_BUFFER_SIZE;
10551056

1056-
/* Return at most EVENT_BUFFER_SIZE events in one call. */
1057-
if (nevents>EVENT_BUFFER_SIZE)
1058-
nevents=EVENT_BUFFER_SIZE;
1059-
1060-
/*
1061-
* If the timeout is -1, wait until at least one event occurs. If the
1062-
* timeout is 0, poll for events, but do not wait at all.
1063-
*/
1064-
noccurred=WaitEventSetWait(node->as_eventset,timeout,occurred_event,
1065-
nevents,WAIT_EVENT_APPEND_READY);
1057+
/*
1058+
* If the timeout is -1, wait until at least one event occurs. If
1059+
* the timeout is 0, poll for events, but do not wait at all.
1060+
*/
1061+
noccurred=WaitEventSetWait(node->as_eventset,timeout,
1062+
occurred_event,nevents,
1063+
WAIT_EVENT_APPEND_READY);
1064+
}
10661065
}
10671066
PG_FINALLY();
10681067
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp