You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hawq.apache.org by huor <gi...@git.apache.org> on 2015/10/30 08:13:54 UTC

[GitHub] incubator-hawq pull request: HAWQ-86. Fix and re-enable unit test ...

GitHub user huor opened a pull request:

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

    HAWQ-86. Fix and re-enable unit test for pxf and external storage

    Please review and comment.

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

    $ git pull https://github.com/huor/incubator-hawq github_huor_unitest

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

    https://github.com/apache/incubator-hawq/pull/64.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 #64
    
----
commit b9f95e2f5136ec4ed36691af9f27e1207127bc10
Author: Ruilong Huo <rh...@pivotal.io>
Date:   2015-10-30T07:10:47Z

    HAWQ-86. Fix and re-enable unit test for pxf and external storage

----


---
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: HAWQ-86. Fix and re-enable unit test ...

Posted by jianlirong <gi...@git.apache.org>.
Github user jianlirong commented on the pull request:

    https://github.com/apache/incubator-hawq/pull/64#issuecomment-152902020
  
    +1. Looks good to me.


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43488567
  
    --- Diff: src/backend/access/external/test/hd_work_mgr_distribute_work_2_gp_segments_test.c ---
    @@ -243,18 +244,24 @@ static void test__distribute_work_to_gp_segments(TestInputData *input)
     	buildCdbComponentDatabases(total_segs, array_of_segs, array_of_primaries);	
     	if (enable_print_input_segments)
     		print_segments_list();
    -		
    -	/* 5. The actual unitest of distribute_work_2_gp_segments() */
    +
    +    /* 5. Build QueryResource */
    +    buildQueryResource(num_hosts_in_cluster*num_segments_on_host, array_of_segs);
    --- End diff --
    
    indentation seems off


---
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: HAWQ-86. Fix and re-enable unit test ...

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

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


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43495672
  
    --- Diff: src/backend/access/external/test/hd_work_mgr_distribute_work_2_gp_segments_test.c ---
    @@ -243,18 +244,24 @@ static void test__distribute_work_to_gp_segments(TestInputData *input)
     	buildCdbComponentDatabases(total_segs, array_of_segs, array_of_primaries);	
     	if (enable_print_input_segments)
     		print_segments_list();
    -		
    -	/* 5. The actual unitest of distribute_work_2_gp_segments() */
    +
    +    /* 5. Build QueryResource */
    +    buildQueryResource(num_hosts_in_cluster*num_segments_on_host, array_of_segs);
    --- End diff --
    
    Yes. I guess it is because of mixed use of blanks and tabs.


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43489506
  
    --- Diff: src/backend/access/external/test_discard/.gitignore ---
    @@ -1 +0,0 @@
    -*.t
    --- End diff --
    
    should probably be added to the test directory


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43495600
  
    --- Diff: src/backend/access/external/test/hd_work_mgr_mock.c ---
    @@ -51,3 +51,49 @@ void restoreCdbComponentDatabases()
     	GpAliveSegmentsInfo.cdbComponentDatabases = orig_cdb;
     	GpAliveSegmentsInfo.aliveSegmentsCount = orig_seg_count;
     }
    +
    +/* Builds the QueryResource for a query */
    +void buildQueryResource(int segs_num,
    +                        char * segs_hostips[])
    +{
    +	resource = (QueryResource *)palloc(sizeof(QueryResource));
    +
    +	resource->segments = NULL;
    +	for (int i = 0; i < segs_num; ++i)
    +	{
    +		Segment *segment = (Segment *)palloc0(sizeof(Segment));
    +		segment->hostip = pstrdup(segs_hostips[i]);
    +		segment->segindex = i;
    +		segment->alive = true;
    +
    +		resource->segments = lappend(resource->segments, segment);
    +	}
    +
    +	return resource;
    +}
    +
    +/* Restores the QueryResource for a query */
    +void restoreQueryResource()
    --- End diff --
    
    Agree. free* is better than restore* here for queryResoruce.


---
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: HAWQ-86. Fix and re-enable unit test ...

Posted by hornn <gi...@git.apache.org>.
Github user hornn commented on the pull request:

    https://github.com/apache/incubator-hawq/pull/64#issuecomment-152489912
  
    +1. Thanks for fixing these tests.


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43496179
  
    --- Diff: src/backend/access/external/test/hd_work_mgr_mock.c ---
    @@ -51,3 +51,49 @@ void restoreCdbComponentDatabases()
     	GpAliveSegmentsInfo.cdbComponentDatabases = orig_cdb;
     	GpAliveSegmentsInfo.aliveSegmentsCount = orig_seg_count;
     }
    +
    +/* Builds the QueryResource for a query */
    +void buildQueryResource(int segs_num,
    +                        char * segs_hostips[])
    +{
    +	resource = (QueryResource *)palloc(sizeof(QueryResource));
    +
    +	resource->segments = NULL;
    +	for (int i = 0; i < segs_num; ++i)
    +	{
    +		Segment *segment = (Segment *)palloc0(sizeof(Segment));
    +		segment->hostip = pstrdup(segs_hostips[i]);
    +		segment->segindex = i;
    +		segment->alive = true;
    +
    +		resource->segments = lappend(resource->segments, segment);
    +	}
    +
    +	return resource;
    +}
    +
    +/* Restores the QueryResource for a query */
    +void restoreQueryResource()
    +{
    +	if (resource)
    +	{
    +		ListCell *cell;
    +
    +		if (resource->segments)
    +		{
    +			cell = list_head(resource->segments);
    +			while(cell != NULL)
    +			{
    +				ListCell *tmp = cell;
    +				cell = lnext(cell);
    +
    +				pfree(((Segment *)lfirst(tmp))->hostip);
    +				pfree(lfirst(tmp));
    +				pfree(tmp);
    +			}
    +		}
    +
    +		pfree(resource);
    --- End diff --
    
    Right. It is a good practice to set resource to NULL since it is a global variable. This will prevent it becomes a dangling pointer.


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43488834
  
    --- Diff: src/backend/access/external/test/hd_work_mgr_mock.c ---
    @@ -51,3 +51,49 @@ void restoreCdbComponentDatabases()
     	GpAliveSegmentsInfo.cdbComponentDatabases = orig_cdb;
     	GpAliveSegmentsInfo.aliveSegmentsCount = orig_seg_count;
     }
    +
    +/* Builds the QueryResource for a query */
    +void buildQueryResource(int segs_num,
    +                        char * segs_hostips[])
    +{
    +	resource = (QueryResource *)palloc(sizeof(QueryResource));
    +
    +	resource->segments = NULL;
    +	for (int i = 0; i < segs_num; ++i)
    +	{
    +		Segment *segment = (Segment *)palloc0(sizeof(Segment));
    +		segment->hostip = pstrdup(segs_hostips[i]);
    +		segment->segindex = i;
    +		segment->alive = true;
    +
    +		resource->segments = lappend(resource->segments, segment);
    +	}
    +
    +	return resource;
    +}
    +
    +/* Restores the QueryResource for a query */
    +void restoreQueryResource()
    +{
    +	if (resource)
    +	{
    +		ListCell *cell;
    +
    +		if (resource->segments)
    +		{
    +			cell = list_head(resource->segments);
    +			while(cell != NULL)
    +			{
    +				ListCell *tmp = cell;
    +				cell = lnext(cell);
    +
    +				pfree(((Segment *)lfirst(tmp))->hostip);
    +				pfree(lfirst(tmp));
    +				pfree(tmp);
    +			}
    +		}
    +
    +		pfree(resource);
    --- End diff --
    
    add resource = NULL?


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43488812
  
    --- Diff: src/backend/access/external/test/hd_work_mgr_mock.c ---
    @@ -51,3 +51,49 @@ void restoreCdbComponentDatabases()
     	GpAliveSegmentsInfo.cdbComponentDatabases = orig_cdb;
     	GpAliveSegmentsInfo.aliveSegmentsCount = orig_seg_count;
     }
    +
    +/* Builds the QueryResource for a query */
    +void buildQueryResource(int segs_num,
    +                        char * segs_hostips[])
    +{
    +	resource = (QueryResource *)palloc(sizeof(QueryResource));
    +
    +	resource->segments = NULL;
    +	for (int i = 0; i < segs_num; ++i)
    +	{
    +		Segment *segment = (Segment *)palloc0(sizeof(Segment));
    +		segment->hostip = pstrdup(segs_hostips[i]);
    +		segment->segindex = i;
    +		segment->alive = true;
    +
    +		resource->segments = lappend(resource->segments, segment);
    +	}
    +
    +	return resource;
    +}
    +
    +/* Restores the QueryResource for a query */
    +void restoreQueryResource()
    --- End diff --
    
    restore* is used when the previous state is restored (relevant in case the variable is static).
    In this case, I think free* is better.


---
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: HAWQ-86. Fix and re-enable unit test ...

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

    https://github.com/apache/incubator-hawq/pull/64#discussion_r43495492
  
    --- Diff: src/backend/access/external/test_discard/.gitignore ---
    @@ -1 +0,0 @@
    -*.t
    --- End diff --
    
    Yes, this is a good idea.


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