From: Kyotaro Horiguchi Date: Wed, 22 Feb 2017 09:12:40 +0900 Subject: [PATCH 09/13] Fix the resource owner to be used Fixup of previous commit. --- src/backend/executor/execAsync.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/backend/executor/execAsync.c b/src/backend/executor/execAsync.c index 588ba18..a8e5f80 100644 --- a/src/backend/executor/execAsync.c +++ b/src/backend/executor/execAsync.c @@ -20,7 +20,7 @@ #include "miscadmin.h" #include "pgstat.h" #include "storage/latch.h" -#include "utils/resowner_private.h" +#include "utils/memutils.h" static bool ExecAsyncEventWait(EState *estate, long timeout); static bool ExecAsyncConfigureWait(EState *estate, PendingAsyncRequest *areq, @@ -297,8 +297,6 @@ ExecAsyncEventWait(EState *estate, long timeout) if (estate->es_wait_event_set == NULL) { - ResourceOwner savedOwner; - /* * Allow for a few extra events without reinitializing. It * doesn't seem worth the complexity of doing anything very @@ -308,26 +306,14 @@ ExecAsyncEventWait(EState *estate, long timeout) estate->es_allocated_fd_events = estate->es_total_fd_events + 16; /* - * The wait event set created here should be released in case of - * error. + * The wait event set created here should be live beyond ExecutorState + * context but released in case of error. */ - savedOwner = CurrentResourceOwner; - CurrentResourceOwner = TopTransactionResourceOwner; - - PG_TRY(); - { - estate->es_wait_event_set = - CreateWaitEventSet(estate->es_query_cxt, - estate->es_allocated_fd_events + 1); - } - PG_CATCH(); - { - CurrentResourceOwner = savedOwner; - PG_RE_THROW(); - } - PG_END_TRY(); + estate->es_wait_event_set = + CreateWaitEventSet(TopTransactionContext, + TopTransactionResourceOwner, + estate->es_allocated_fd_events + 1); - CurrentResourceOwner = savedOwner; AddWaitEventToSet(estate->es_wait_event_set, WL_LATCH_SET, PGINVALID_SOCKET, MyLatch, NULL); reinit = true; -- 2.9.2 ----Next_Part(Wed_Feb_22_17_39_45_2017_090)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0008-Allow-wait-event-set-to-be-registered-to-resource-ow.patch"