hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hubertzh...@apache.org
Subject incubator-hawq git commit: HAWQ-1032. Bucket number of new added partition is not consistent with parent table.
Date Thu, 01 Sep 2016 02:31:18 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 030491b89 -> 193dad37e


HAWQ-1032. Bucket number of new added partition is not consistent with parent table.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/193dad37
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/193dad37
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/193dad37

Branch: refs/heads/master
Commit: 193dad37e9ad80ccbd996511f515f8e5d61cdfe8
Parents: 030491b
Author: hzhang2 <zhanghuan929@163.com>
Authored: Thu Sep 1 09:33:58 2016 +0800
Committer: hzhang2 <zhanghuan929@163.com>
Committed: Thu Sep 1 10:30:54 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbpartition.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/193dad37/src/backend/cdb/cdbpartition.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbpartition.c b/src/backend/cdb/cdbpartition.c
index f6bbf0d..06e4805 100644
--- a/src/backend/cdb/cdbpartition.c
+++ b/src/backend/cdb/cdbpartition.c
@@ -6381,7 +6381,7 @@ atpxPartAddList(Relation rel,
 								NULL /*catalogname*/, 
 								get_namespace_name(RelationGetNamespace(par_rel)),
 								RelationGetRelationName(par_rel), -1);
-	
+
 	if (bOpenGap) /* might need a gap to insert the new partition */
 	{
 		AlterPartitionId 	 	 pid;
@@ -6417,6 +6417,8 @@ atpxPartAddList(Relation rel,
 								CurrentMemoryContext);
 	}
 	
+	GpPolicy * parPolicy = GpPolicyFetch(CurrentMemoryContext,
+	          RelationGetRelationName(par_rel));
 	{
 		List			*l1;
 		ListCell		*lc;
@@ -6546,8 +6548,7 @@ atpxPartAddList(Relation rel,
 				skipTableRelid = RangeVarGetRelid(t->relation, true, false /*allowHcatalog*/);
 			}
 		}
-		
-		
+
 		for_each_cell(lc, lnext(lc))
 		{
 			Query *q = lfirst(lc);
@@ -6621,6 +6622,10 @@ atpxPartAddList(Relation rel,
 			{
 				/* propagate owner */
 				((CreateStmt *)q->utilityStmt)->ownerid = ownerid;
+				/* child partition should have the same bucket number with parent partition */
+				if (parPolicy) {
+				  ((CreateStmt *)q->utilityStmt)->policy->bucketnum = parPolicy->bucketnum;
+				}
 			}
 			
 			/* normal case - add partitions using CREATE statements
@@ -6698,6 +6703,8 @@ atpxPartAddList(Relation rel,
 		} /* end for each cell */
 		
 	}
+	if(parPolicy)
+	  pfree(parPolicy);
 	
 	if (par_prule && par_prule->topRule)
 		heap_close(par_rel, NoLock);


Mime
View raw message