You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by hu...@apache.org on 2015/12/16 07:25:11 UTC
incubator-hawq git commit: HAWQ-218. Core dump while selecting data
from partitioned table with where condition that belongs to no partition
Repository: incubator-hawq
Updated Branches:
refs/heads/master 56b0ab01a -> 18300ea8f
HAWQ-218. Core dump while selecting data from partitioned table with where condition that belongs to no partition
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/18300ea8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/18300ea8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/18300ea8
Branch: refs/heads/master
Commit: 18300ea8f6fbe80f74856a2fdaecb0a59713b5ca
Parents: 56b0ab0
Author: Ruilong Huo <rh...@pivotal.io>
Authored: Tue Dec 15 19:37:37 2015 -0800
Committer: Ruilong Huo <rh...@pivotal.io>
Committed: Wed Dec 16 14:24:48 2015 +0800
----------------------------------------------------------------------
src/backend/cdb/cdbdatalocality.c | 11 ++++++-
src/backend/optimizer/plan/planner.c | 49 ++++++++++++++++---------------
src/include/cdb/cdbdatalocality.h | 3 +-
3 files changed, 37 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/18300ea8/src/backend/cdb/cdbdatalocality.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbdatalocality.c b/src/backend/cdb/cdbdatalocality.c
index 5c3cbde..5f7cd1c 100644
--- a/src/backend/cdb/cdbdatalocality.c
+++ b/src/backend/cdb/cdbdatalocality.c
@@ -3903,7 +3903,7 @@ static void cleanup_allocation_algorithm(
*/
SplitAllocResult *
calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
- List *fullRangeTable, GpPolicy *intoPolicy, int sliceNum) {
+ List *fullRangeTable, GpPolicy *intoPolicy, int sliceNum, int dispatchType) {
SplitAllocResult *result;
QueryResource *resource = NULL;
List *virtual_segments;
@@ -4106,6 +4106,15 @@ calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
minTargetSegmentNumber = minimum_segment_num;
}
+ /*
+ * Allocate only one virtual segment for query that execute on entry database
+ */
+ if (dispatchType == DISPATCH_SEQUENTIAL)
+ {
+ maxTargetSegmentNumber = 1;
+ minTargetSegmentNumber = 1;
+ }
+
if (enforce_virtual_segment_number > 0) {
maxTargetSegmentNumber = enforce_virtual_segment_number;
minTargetSegmentNumber = enforce_virtual_segment_number;
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/18300ea8/src/backend/optimizer/plan/planner.c
----------------------------------------------------------------------
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index b09389a..b1f2b93 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -453,32 +453,33 @@ static void
resource_negotiator(Query *parse, int cursorOptions, ParamListInfo boundParams,
QueryResourceLife resourceLife, ResourceNegotiatorResult** result)
{
- PlannedStmt *plannedstmt = NULL;
- do
- {
- SplitAllocResult *allocResult = NULL;
- Query *my_parse = copyObject(parse);
- ParamListInfo my_boundParams = copyParamList(boundParams);
-
- plannedstmt = standard_planner(my_parse, cursorOptions, my_boundParams);
- (*result)->stmt = plannedstmt;
-
- /* If this is a parallel plan. */
- if (plannedstmt->planTree->dispatch == DISPATCH_PARALLEL)
- {
- /*
- * Now, we want to allocate resource.
- */
- allocResult = calculate_planner_segment_num(my_parse, resourceLife,
- plannedstmt->rtable, plannedstmt->intoPolicy,
- plannedstmt->nMotionNodes + plannedstmt->nInitPlans + 1);
+ PlannedStmt *plannedstmt = NULL;
+ do
+ {
+ SplitAllocResult *allocResult = NULL;
+ Query *my_parse = copyObject(parse);
+ ParamListInfo my_boundParams = copyParamList(boundParams);
- Assert(allocResult);
+ plannedstmt = standard_planner(my_parse, cursorOptions, my_boundParams);
+ (*result)->stmt = plannedstmt;
- (*result)->saResult = *allocResult;
- pfree(allocResult);
- }
- } while (0);
+ /* If this is a parallel plan. */
+ if (plannedstmt->planTree->dispatch != DISPATCH_UNDETERMINED)
+ {
+ /*
+ * Now, we want to allocate resource.
+ */
+ allocResult = calculate_planner_segment_num(my_parse, resourceLife,
+ plannedstmt->rtable, plannedstmt->intoPolicy,
+ plannedstmt->nMotionNodes + plannedstmt->nInitPlans + 1,
+ plannedstmt->planTree->dispatch);
+
+ Assert(allocResult);
+
+ (*result)->saResult = *allocResult;
+ pfree(allocResult);
+ }
+ } while (0);
}
static PlannedStmt *
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/18300ea8/src/include/cdb/cdbdatalocality.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/cdbdatalocality.h b/src/include/cdb/cdbdatalocality.h
index 902fc18..b3ebc69 100644
--- a/src/include/cdb/cdbdatalocality.h
+++ b/src/include/cdb/cdbdatalocality.h
@@ -69,7 +69,8 @@ typedef struct VirtualSegmentNode
* we calculate the appropriate planner segment_num.
*/
SplitAllocResult * calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
- List *rtable, GpPolicy *intoPolicy, int sliceNum);
+ List *rtable, GpPolicy *intoPolicy, int sliceNum,
+ int dispatchType);
FILE *fp;
FILE *fpaoseg;