hawq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhangh43 <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request: HAWQ-234. Improve HAWQ resource manag...
Date Fri, 11 Dec 2015 09:52:06 GMT
Github user zhangh43 commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/169#discussion_r47337343
  
    --- Diff: src/backend/resourcemanager/resqueuemanager.c ---
    @@ -2165,103 +2165,87 @@ void cancelResourceAllocRequest(ConnectionTrack conntrack)
     	/* Unlock session in deadlock */
     	unlockSessionResource(&(queuetrack->DLDetector), conntrack->SessionID);
     
    -	buildTimeoutResponseForQueuedRequest(conntrack, RESQUEMGR_NORESOURCE_TIMEOUT);
    +	buildTimeoutResponseForQueuedRequest(conntrack,
    +										 RESQUEMGR_NORESOURCE_TIMEOUT,
    +										 errorbuf);
     }
     
     /* Acquire resource from queue. */
    -int acquireResourceFromResQueMgr(ConnectionTrack conntrack)
    +int acquireResourceFromResQueMgr(ConnectionTrack  conntrack,
    +								 char 			 *errorbuf,
    +								 int 			  errorbufsize)
     {
    -	int						res			  	= FUNC_RETURN_OK;
    -
    -	DynResourceQueueTrack   queuetrack	  	= conntrack->QueueTrack;
    -
    -	if ( queuetrack->ClusterSegNumberMax == 0 )
    -	{
    -		elog(LOG, "The queue %s has no resource available to run queries.",
    -				  queuetrack->QueueInfo->Name);
    -		return RESQUEMGR_NO_RESOURCE;
    -	}
    +	int						res			= FUNC_RETURN_OK;
    +	DynResourceQueueTrack	queuetrack	= conntrack->QueueTrack;
     
     	/* Call quota logic to make decision of resource for current query. */
    -	res = computeQueryQuota(conntrack);
    +	res = computeQueryQuota(conntrack, errorbuf, errorbufsize);
     
     	if ( res == FUNC_RETURN_OK )
     	{
     		if ( conntrack->StatNVSeg == 0 )
     		{
    -			int32_t Rmax  = conntrack->SegNum;
    -			int32_t RmaxL = conntrack->VSegLimitPerSeg * PRESPOOL->AvailNodeCount;
    -			int32_t Rmin  = conntrack->SegNumMin;
    -			elog(LOG, "Original quota min seg num:%d, max seg num:%d",
    -					  conntrack->SegNumMin,
    -					  conntrack->SegNum);
    -
    -			/* Ensure quota [min,max] is between request [min,max] */
    -			int32_t Gmax= conntrack->MaxSegCountFixed;
    -			int32_t Gmin= conntrack->MinSegCountFixed;
    -
    -			if(Gmin==1)
    -			{
    -				/* case 1 */
    -				conntrack->SegNumMin = min(min(Gmax,Rmin),RmaxL);
    -				conntrack->SegNum = min(Gmax,RmaxL);
    -				if(conntrack->SegNumMin > conntrack->SegNum)
    -				{
    -					return RESQUEMGR_NO_RESOURCE;
    -				}
    -			}
    -			else if(Gmax == Gmin)
    -			{
    -				/* case 2 */
    -				conntrack->SegNumMin = Gmax;
    -				conntrack->SegNum = Gmax;
    -				if(Rmax < Gmax)
    -				{
    -					return RESQUEMGR_NO_RESOURCE;
    -				}
    -			}
    -			else
    -			{
    -				/* case 3 */
    -				conntrack->SegNumMin = min(max(Gmin,Rmin),Gmax);
    -				conntrack->SegNum = min(max(min(RmaxL,Gmax),Gmin),Rmax);
    -				if(conntrack->SegNumMin > conntrack->SegNum)
    -				{
    -					return RESQUEMGR_NO_RESOURCE;
    -				}
    -			}
    -
    -			elog(LOG, "Query resource expects (%d MB, %lf CORE) x %d ( min %d ) resource.",
    -					   conntrack->SegMemoryMB,
    -					   conntrack->SegCore,
    -					   conntrack->SegNum,
    -					   conntrack->SegNumMin);
    -
    +			/*------------------------------------------------------------------
    +			 * The following logic consider the actual resource requirement from
    +			 * dispatcher based on table size, workload, etc. The requirement is
    +			 * described by (MinSegCountFixed, MaxSegCountFixed). The requirement
    +			 * can be satisfied only when there is a non-empty intersect between
    +			 * (MinSegCountFixed, MaxSegCountFixed) and (SegNumMin, SegNum).
    +			 *------------------------------------------------------------------
    +			 */
    +			conntrack->SegNumMin =
    +				conntrack->MaxSegCountFixed < conntrack->SegNumMin ?
    +				conntrack->MinSegCountFixed :
    +				max(conntrack->SegNumMin, conntrack->MinSegCountFixed);
    +
    +			conntrack->SegNum = min(conntrack->SegNum,
    --- End diff --
    
    can you explain the meaning of MinSegCountFixed, MaxSegCountFixed, MinSegCountFixed and
MaxSegCountFixed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message