You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by amyrazz44 <gi...@git.apache.org> on 2017/08/11 01:57:02 UTC

[GitHub] incubator-hawq pull request #1279: HAWQ-1310. Reformat resource_negotiator()...

GitHub user amyrazz44 opened a pull request:

    https://github.com/apache/incubator-hawq/pull/1279

    HAWQ-1310. Reformat resource_negotiator().

    @jiny2 @linwen pls feel free to review this pull request, thank you.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/amyrazz44/incubator-hawq RM

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-hawq/pull/1279.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1279
    
----
commit 2d98f0b3ae013a76a28f4c045a9e719eb1276d2e
Author: amyrazz44 <ab...@pivotal.io>
Date:   2017-08-09T02:57:14Z

    HAWQ-1310. Reformat resource_negotiator().

----


---
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.
---

[GitHub] incubator-hawq pull request #1279: HAWQ-1310. Reformat resource_negotiator()...

Posted by linwen <gi...@git.apache.org>.
Github user linwen commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/1279#discussion_r132612133
  
    --- Diff: src/backend/optimizer/plan/planner.c ---
    @@ -438,256 +438,224 @@ PlannedStmt *refineCachedPlan(PlannedStmt * plannedstmt,
      *
      *****************************************************************************/
     
    -PlannedStmt * 
    -planner(Query *parse, int cursorOptions,
    -		ParamListInfo boundParams, QueryResourceLife resourceLife)
    -{
    -	PlannedStmt *result = NULL;
    -	instr_time	starttime, endtime;
    -	ResourceNegotiatorResult *ppResult = (ResourceNegotiatorResult *) palloc(sizeof(ResourceNegotiatorResult));
    -	SplitAllocResult initResult = {NULL, NIL, 0, NIL, NULL};
    -	ppResult->saResult = initResult;
    -	ppResult->stmt = NULL;
    -	static int plannerLevel = 0;
    -	bool resourceNegotiateDone = false;
    -	QueryResource *savedQueryResource = GetActiveQueryResource();
    -	SetActiveRelType(NIL);
    -
    -	bool isDispatchParallel = false;
    -	/*
    -	 * Before doing the true query optimization, we first run a resource_negotiator to give
    -	 * us some sense of the complexity of the query, and allocate the appropriate
    -	 * resource to run this query. After gaining the resource, we can perform the
    -	 * actual optimization.
    -	 */
    -	increase_planning_depth();
    -
    -	plannerLevel++;
    -	if (!resourceNegotiateDone)
    -	{
    -	  PG_TRY();
    -	  {
    -      START_MEMORY_ACCOUNT(MemoryAccounting_CreateAccount(0, MEMORY_OWNER_TYPE_Resource_Negotiator));
    -      {
    -        resource_negotiator(parse, cursorOptions, boundParams, resourceLife, &ppResult);
    -
    -		decrease_planning_depth();
    -
    -		if(ppResult->stmt && ppResult->stmt->planTree)
    -		{
    -			isDispatchParallel = ppResult->stmt->planTree->dispatch == DISPATCH_PARALLEL;
    -		}
    -      }
    -      END_MEMORY_ACCOUNT();
    -	  }
    -	  PG_CATCH();
    -	  {
    -		decrease_planning_depth();
    -
    -		if ((ppResult != NULL))
    -		{
    -		  pfree(ppResult);
    -		  ppResult = NULL;
    -		}
    -	    plannerLevel = 0;
    -	    PG_RE_THROW();
    -	  }
    -	  PG_END_TRY();
    -	}
    -	SetActiveRelType(NIL);
    -	if (plannerLevel >= 1)
    -	{
    -	  resourceNegotiateDone = true;
    -	  gp_segments_for_planner = ppResult->saResult.planner_segments;
    -	  if (ppResult->saResult.resource)
    -	  {
    -	    SetActiveQueryResource(ppResult->saResult.resource);
    -	    SetActiveRelType(ppResult->saResult.relsType);
    -	  }
    -	}
    +PlannedStmt *
    +planner(Query *parse, int cursorOptions, ParamListInfo boundParams, QueryResourceLife resourceLife) {
    +    PlannedStmt *result = NULL;
    +    instr_time starttime, endtime;
    +    ResourceNegotiatorResult *ppResult = (ResourceNegotiatorResult *) palloc(sizeof(ResourceNegotiatorResult));
    +    SplitAllocResult initResult = { NULL, NIL, 0, NIL, NULL };
    +    ppResult->saResult = initResult;
    +    ppResult->stmt = NULL;
    +    static int plannerLevel = 0;
    +    bool resourceNegotiateDone = false;
    +    QueryResource *savedQueryResource = GetActiveQueryResource();
    +    SetActiveRelType(NIL);
    +
    +    bool isDispatchParallel = false;
    +    /*
    +     * Before doing the true query optimization, we first run a resource_negotiator to give
    +     * us some sense of the complexity of the query, and allocate the appropriate
    +     * resource to run this query. After gaining the resource, we can perform the
    +     * actual optimization.
    +     */
    +    increase_planning_depth();
    +
    +    plannerLevel++;
    +    if (!resourceNegotiateDone) {
    +        PG_TRY();
    +            {
    +                START_MEMORY_ACCOUNT(MemoryAccounting_CreateAccount(0, MEMORY_OWNER_TYPE_Resource_Negotiator));
    +                    {
    +                        resource_negotiator(parse, cursorOptions, boundParams, resourceLife, &ppResult);
    +
    +                        decrease_planning_depth();
    +
    +                        if (ppResult->stmt && ppResult->stmt->planTree) {
    +                            isDispatchParallel = ppResult->stmt->planTree->dispatch == DISPATCH_PARALLEL;
    +                        }
    +                    }
    +                    END_MEMORY_ACCOUNT();
    +            }PG_CATCH();
    +            {
    +                decrease_planning_depth();
    +
    +                if ((ppResult != NULL)) {
    +                    pfree(ppResult);
    +                    ppResult = NULL;
    +                }
    +                plannerLevel = 0;
    +                PG_RE_THROW();
    +            }PG_END_TRY();
    +    }
    +    SetActiveRelType(NIL);
    +    if (plannerLevel >= 1) {
    +        resourceNegotiateDone = true;
    +        gp_segments_for_planner = ppResult->saResult.planner_segments;
    +        if (ppResult->saResult.resource) {
    +            SetActiveQueryResource(ppResult->saResult.resource);
    +            SetActiveRelType(ppResult->saResult.relsType);
    +        }
    +    }
     
    -	int optimizer_segments_saved_value = optimizer_segments;
    +    int optimizer_segments_saved_value = optimizer_segments;
     
    -	PG_TRY();
    -	{
    -    if (resourceNegotiateDone)
    -    {
    +    PG_TRY();
    +        {
    --- End diff --
    
    Indent from here doesn't align. Please fix.


---
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.
---

[GitHub] incubator-hawq pull request #1279: HAWQ-1310. Reformat resource_negotiator()...

Posted by linwen <gi...@git.apache.org>.
Github user linwen commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/1279#discussion_r132612181
  
    --- Diff: src/backend/optimizer/plan/planner.c ---
    @@ -438,256 +438,224 @@ PlannedStmt *refineCachedPlan(PlannedStmt * plannedstmt,
      *
      *****************************************************************************/
     
    -PlannedStmt * 
    -planner(Query *parse, int cursorOptions,
    -		ParamListInfo boundParams, QueryResourceLife resourceLife)
    -{
    -	PlannedStmt *result = NULL;
    -	instr_time	starttime, endtime;
    -	ResourceNegotiatorResult *ppResult = (ResourceNegotiatorResult *) palloc(sizeof(ResourceNegotiatorResult));
    -	SplitAllocResult initResult = {NULL, NIL, 0, NIL, NULL};
    -	ppResult->saResult = initResult;
    -	ppResult->stmt = NULL;
    -	static int plannerLevel = 0;
    -	bool resourceNegotiateDone = false;
    -	QueryResource *savedQueryResource = GetActiveQueryResource();
    -	SetActiveRelType(NIL);
    -
    -	bool isDispatchParallel = false;
    -	/*
    -	 * Before doing the true query optimization, we first run a resource_negotiator to give
    -	 * us some sense of the complexity of the query, and allocate the appropriate
    -	 * resource to run this query. After gaining the resource, we can perform the
    -	 * actual optimization.
    -	 */
    -	increase_planning_depth();
    -
    -	plannerLevel++;
    -	if (!resourceNegotiateDone)
    -	{
    -	  PG_TRY();
    -	  {
    -      START_MEMORY_ACCOUNT(MemoryAccounting_CreateAccount(0, MEMORY_OWNER_TYPE_Resource_Negotiator));
    -      {
    -        resource_negotiator(parse, cursorOptions, boundParams, resourceLife, &ppResult);
    -
    -		decrease_planning_depth();
    -
    -		if(ppResult->stmt && ppResult->stmt->planTree)
    -		{
    -			isDispatchParallel = ppResult->stmt->planTree->dispatch == DISPATCH_PARALLEL;
    -		}
    -      }
    -      END_MEMORY_ACCOUNT();
    -	  }
    -	  PG_CATCH();
    -	  {
    -		decrease_planning_depth();
    -
    -		if ((ppResult != NULL))
    -		{
    -		  pfree(ppResult);
    -		  ppResult = NULL;
    -		}
    -	    plannerLevel = 0;
    -	    PG_RE_THROW();
    -	  }
    -	  PG_END_TRY();
    -	}
    -	SetActiveRelType(NIL);
    -	if (plannerLevel >= 1)
    -	{
    -	  resourceNegotiateDone = true;
    -	  gp_segments_for_planner = ppResult->saResult.planner_segments;
    -	  if (ppResult->saResult.resource)
    -	  {
    -	    SetActiveQueryResource(ppResult->saResult.resource);
    -	    SetActiveRelType(ppResult->saResult.relsType);
    -	  }
    -	}
    +PlannedStmt *
    +planner(Query *parse, int cursorOptions, ParamListInfo boundParams, QueryResourceLife resourceLife) {
    +    PlannedStmt *result = NULL;
    +    instr_time starttime, endtime;
    +    ResourceNegotiatorResult *ppResult = (ResourceNegotiatorResult *) palloc(sizeof(ResourceNegotiatorResult));
    +    SplitAllocResult initResult = { NULL, NIL, 0, NIL, NULL };
    +    ppResult->saResult = initResult;
    +    ppResult->stmt = NULL;
    +    static int plannerLevel = 0;
    +    bool resourceNegotiateDone = false;
    +    QueryResource *savedQueryResource = GetActiveQueryResource();
    +    SetActiveRelType(NIL);
    +
    +    bool isDispatchParallel = false;
    +    /*
    +     * Before doing the true query optimization, we first run a resource_negotiator to give
    +     * us some sense of the complexity of the query, and allocate the appropriate
    +     * resource to run this query. After gaining the resource, we can perform the
    +     * actual optimization.
    +     */
    +    increase_planning_depth();
    +
    +    plannerLevel++;
    +    if (!resourceNegotiateDone) {
    +        PG_TRY();
    +            {
    --- End diff --
    
    Indent here doesn't align. Please fix.


---
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.
---

[GitHub] incubator-hawq pull request #1279: HAWQ-1310. Reformat resource_negotiator()...

Posted by amyrazz44 <gi...@git.apache.org>.
Github user amyrazz44 closed the pull request at:

    https://github.com/apache/incubator-hawq/pull/1279


---
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.
---

[GitHub] incubator-hawq issue #1279: HAWQ-1310. Reformat resource_negotiator().

Posted by jiny2 <gi...@git.apache.org>.
Github user jiny2 commented on the issue:

    https://github.com/apache/incubator-hawq/pull/1279
  
    Please close this pr as per my understanding it has been delivered last week.


---
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.
---

[GitHub] incubator-hawq issue #1279: HAWQ-1310. Reformat resource_negotiator().

Posted by jinyismilodon <gi...@git.apache.org>.
Github user jinyismilodon commented on the issue:

    https://github.com/apache/incubator-hawq/pull/1279
  
    This has been delivered last week per my understanding, please close it @amyrazz44 . Thanks.


---
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.
---

[GitHub] incubator-hawq issue #1279: HAWQ-1310. Reformat resource_negotiator().

Posted by stanlyxiang <gi...@git.apache.org>.
Github user stanlyxiang commented on the issue:

    https://github.com/apache/incubator-hawq/pull/1279
  
    +1


---
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.
---

[GitHub] incubator-hawq issue #1279: HAWQ-1310. Reformat resource_negotiator().

Posted by jiny2 <gi...@git.apache.org>.
Github user jiny2 commented on the issue:

    https://github.com/apache/incubator-hawq/pull/1279
  
    +1 LGTM. Thanks for fixing this so quickly.


---
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.
---