agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Kyotaro Horiguchi <[email protected]>
Subject: [PATCH 09/13] Fix the resource owner to be used
Date: Wed, 22 Feb 2017 09:12:40 +0900

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"



view thread (19+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH 09/13] Fix the resource owner to be used
  In-Reply-To: <no-message-id-552915@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox