[
https://issues.apache.org/jira/browse/HAWQ-234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15052545#comment-15052545
]
ASF GitHub Bot commented on HAWQ-234:
-------------------------------------
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?
> Improve HAWQ resource manager resource allocation algorithm and RPC framework
> -----------------------------------------------------------------------------
>
> Key: HAWQ-234
> URL: https://issues.apache.org/jira/browse/HAWQ-234
> Project: Apache HAWQ
> Issue Type: Improvement
> Components: Resource Manager
> Reporter: Yi Jin
> Assignee: Yi Jin
>
> 1) reject resource request from dispatcher at once if too many segments
> unavailable;
> 2) explain how many segments unavailable in current cluster when the resource
> request is rejected;
> 3) make error message string generated in resource manager process only for
> all resource manager RPCs;
> 4) change NVSEG_* limits semantic meanings to latest version;
> 5) minimum vseg number for one resource request is changed to queue vseg num
> / active_statements, but the request having only a few vseg required is not
> changed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)