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

Commite10ca95

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 parent19b8481 commite10ca95

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
@@ -6972,14 +6972,16 @@ postgresForeignAsyncConfigureWait(AsyncRequest *areq)
69726972
{
69736973
/*
69746974
* This is the case when the in-process request was made by another
6975-
* Append. Note that it might be useless to process the request,
6976-
* because the query might not need tuples from that Append anymore.
6977-
* If there are any child subplans of the same parent that are ready
6978-
* for new requests, skip the given request. Likewise, if there are
6979-
* any configured events other than the postmaster death event, skip
6980-
* it. Otherwise, process the in-process request, then begin a fetch
6981-
* to configure the event below, because we might otherwise end up
6982-
* with no configured events other than the postmaster death event.
6975+
* Append. Note that it might be useless to process the request made
6976+
* by that Append, because the query might not need tuples from that
6977+
* Append anymore; so we avoid processing it to begin a fetch for the
6978+
* given request if possible. If there are any child subplans of the
6979+
* same parent that are ready for new requests, skip the given
6980+
* request. Likewise, if there are any configured events other than
6981+
* the postmaster death event, skip it. Otherwise, process the
6982+
* in-process request, then begin a fetch to configure the event
6983+
* below, because we might otherwise end up with no configured events
6984+
* other than the postmaster death event.
69836985
*/
69846986
if (!bms_is_empty(requestor->as_needrequest))
69856987
return;

‎src/backend/executor/nodeAppend.c

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

10491049
/*
1050-
*No need for further processing ifthere are no configured events
1051-
*other than the postmaster death event.
1050+
*Ifthere are no configured events other than the postmaster death
1051+
*event, we don't need to wait or poll.
10521052
*/
10531053
if (GetNumRegisteredWaitEvents(node->as_eventset)==1)
1054+
noccurred=0;
1055+
else
10541056
{
1055-
FreeWaitEventSet(node->as_eventset);
1056-
node->as_eventset=NULL;
1057-
return;
1058-
}
1057+
/* Return at most EVENT_BUFFER_SIZE events in one call. */
1058+
if (nevents>EVENT_BUFFER_SIZE)
1059+
nevents=EVENT_BUFFER_SIZE;
10591060

1060-
/* Return at most EVENT_BUFFER_SIZE events in one call. */
1061-
if (nevents>EVENT_BUFFER_SIZE)
1062-
nevents=EVENT_BUFFER_SIZE;
1063-
1064-
/*
1065-
* If the timeout is -1, wait until at least one event occurs. If the
1066-
* timeout is 0, poll for events, but do not wait at all.
1067-
*/
1068-
noccurred=WaitEventSetWait(node->as_eventset,timeout,occurred_event,
1069-
nevents,WAIT_EVENT_APPEND_READY);
1061+
/*
1062+
* If the timeout is -1, wait until at least one event occurs. If
1063+
* the timeout is 0, poll for events, but do not wait at all.
1064+
*/
1065+
noccurred=WaitEventSetWait(node->as_eventset,timeout,
1066+
occurred_event,nevents,
1067+
WAIT_EVENT_APPEND_READY);
1068+
}
10701069
}
10711070
PG_FINALLY();
10721071
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp