You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by zt...@apache.org on 2021/12/27 08:39:28 UTC

[hawq] branch ztao updated (6f927fb -> bd88dbd)

This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a change to branch ztao
in repository https://gitbox.apache.org/repos/asf/hawq.git.


 discard 6f927fb  SUPPORT-416. fix rewrite ddl request resoure in UDF
     new bd88dbd  HAWQ-1823. avoid of reallocating resource in udf

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (6f927fb)
            \
             N -- N -- N   refs/heads/ztao (bd88dbd)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

[hawq] 01/01: HAWQ-1823. avoid of reallocating resource in udf

Posted by zt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a commit to branch ztao
in repository https://gitbox.apache.org/repos/asf/hawq.git

commit bd88dbd9081577e441220ba8d39fcda31ebe0dc2
Author: ztao1987 <zh...@gmail.com>
AuthorDate: Mon Dec 27 16:36:44 2021 +0800

    HAWQ-1823. avoid of reallocating resource in udf
---
 src/backend/commands/indexcmds.c              | 10 +++++++++-
 src/backend/commands/tablecmds.c              | 14 +++++++++++---
 src/backend/resourcemanager/resqueuemanager.c |  4 ++--
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 1c8c3d1..fdd065e 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -147,7 +147,15 @@ bool CDBCreateIndex(IndexStmt *stmt, Oid relationOid, Oid indexOid)
 
 	elog(DEBUG1, "CDBCreateIndex virtual segment number is: %d\n", target_segment_num);
 
-	QueryResource *resource = AllocateResource(QRL_ONCE, 1, 1, target_segment_num, target_segment_num, NULL, 0);
+	QueryResource *resource = NULL;
+	QueryResource *savedResource = NULL;
+	savedResource = GetActiveQueryResource();
+	if (!savedResource) {
+	  resource = AllocateResource(QRL_ONCE, 1, 1, target_segment_num, target_segment_num, NULL, 0);
+	} else {
+	  resource = AllocateResource(QRL_INHERIT, 0, 0, 0, 0, NULL, 0);
+	}
+	SetActiveQueryResource(resource);
 
 	/* 4.bind SegNO to Vseg */
 	int total_segfiles = 0;
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index a21d803..60dc98b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -7219,8 +7219,12 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
       }
 		}
 
-	  resource = AllocateResource(QRL_ONCE, 1, 1, target_segment_num, target_segment_num,NULL,0);
-	  savedResource = GetActiveQueryResource();
+		savedResource = GetActiveQueryResource();
+		if (!savedResource) {
+		  resource = AllocateResource(QRL_ONCE, 1, 1, target_segment_num, target_segment_num,NULL,0);
+		} else {
+		  resource = AllocateResource(QRL_INHERIT, 0, 0, 0, 0, NULL, 0);
+		}
 	  SetActiveQueryResource(resource);
 
 	  segment_segnos = SetSegnoForWrite(NIL, 0, target_segment_num, true, true, false);
@@ -17578,8 +17582,12 @@ ATPExecPartSplit(Relation rel,
 
     }
 
-    resource = AllocateResource(QRL_ONCE, 1, 1, target_segment_num, target_segment_num, NULL, 0);
     savedResource = GetActiveQueryResource();
+    if (!savedResource) {
+      resource = AllocateResource(QRL_ONCE, 1, 1, target_segment_num, target_segment_num, NULL, 0);
+    } else {
+      resource = AllocateResource(QRL_INHERIT, 0, 0, 0, 0, NULL, 0);
+    }
     SetActiveQueryResource(resource);
     segment_segnos = SetSegnoForWrite(NIL, 0, target_segment_num, true, true, false);
     scantable_splits = NIL;
diff --git a/src/backend/resourcemanager/resqueuemanager.c b/src/backend/resourcemanager/resqueuemanager.c
index 16d4087..1a8807a 100644
--- a/src/backend/resourcemanager/resqueuemanager.c
+++ b/src/backend/resourcemanager/resqueuemanager.c
@@ -4385,8 +4385,8 @@ void buildAcquireResourceResponseMessage(ConnectionTrack conn)
 	conn->MessageID    = RESPONSE_QD_ACQUIRE_RESOURCE;
 	conn->ResAllocTime = gettime_microsec();
 
-	elog(LOG, "latency of getting resource allocated is "UINT64_FORMAT "us",
-			  conn->ResAllocTime - conn->ResRequestTime);
+	elog(LOG, "ConnID %d latency of getting resource allocated is "UINT64_FORMAT "us",
+			  conn->ConnID, conn->ResAllocTime - conn->ResRequestTime);
 
 	MEMORY_CONTEXT_SWITCH_TO(PCONTEXT)
 	PCONTRACK->ConnToSend = lappend(PCONTRACK->ConnToSend, conn);