You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by od...@apache.org on 2016/03/31 02:24:24 UTC
[31/38] incubator-hawq git commit: HAWQ-562. Refactor bucket number
of external table.
HAWQ-562. Refactor bucket number of external 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/db281d5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/db281d5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/db281d5f
Branch: refs/heads/HAWQ-546
Commit: db281d5f94ecce82dfd80d314488d6d970b15ade
Parents: 4217f75
Author: hzhang2 <zh...@163.com>
Authored: Mon Mar 28 10:17:17 2016 +0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Wed Mar 30 17:23:32 2016 -0700
----------------------------------------------------------------------
src/backend/cdb/cdbdatalocality.c | 7 ++++++-
src/backend/commands/tablecmds.c | 23 ++++++++++++++---------
src/backend/postmaster/identity.c | 2 +-
3 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/db281d5f/src/backend/cdb/cdbdatalocality.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbdatalocality.c b/src/backend/cdb/cdbdatalocality.c
index 4c67429..cbe1222 100644
--- a/src/backend/cdb/cdbdatalocality.c
+++ b/src/backend/cdb/cdbdatalocality.c
@@ -768,7 +768,8 @@ static void check_keep_hash_and_external_table(
* whose default value is set to default_segment_num
*/
ExtTableEntry* extEnrty = GetExtTableEntry(rel->rd_id);
- if(extEnrty->isweb){
+ if(extEnrty->command){
+ // command external table case
if (context->externTableOnClauseSegNum == 0) {
context->externTableOnClauseSegNum = targetPolicy->bucketnum;
} else {
@@ -782,6 +783,7 @@ static void check_keep_hash_and_external_table(
}
}
else{
+ // gpfdist location case.
if (context->externTableLocationSegNum < targetPolicy->bucketnum) {
context->externTableLocationSegNum = targetPolicy->bucketnum;
context->minimum_segment_num = targetPolicy->bucketnum;
@@ -4256,6 +4258,9 @@ calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
}
} else {
maxTargetSegmentNumber = context.randomSegNum;
+ if(context.externTableLocationSegNum > 0 && maxTargetSegmentNumber < GetQueryVsegNum()){
+ maxTargetSegmentNumber = GetQueryVsegNum();
+ }
minTargetSegmentNumber = context.minimum_segment_num;
}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/db281d5f/src/backend/commands/tablecmds.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d858d5c..4595f9a 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -387,7 +387,7 @@ static void update_ri_trigger_args(Oid relid,
const char *newname,
bool fk_scan,
bool update_relname);
-static Datum transformLocationUris(List *locs, List* fmtopts, bool isweb, bool iswritable);
+static Datum transformLocationUris(List *locs, List* fmtopts, bool isweb, bool iswritable, bool* isCustom);
static Datum transformExecOnClause(List *on_clause, int *preferred_segment_num, bool iswritable);
static char transformFormatType(char *formatname);
static Datum transformFormatOpts(char formattype, List *formatOpts, int numcols, bool iswritable);
@@ -959,19 +959,21 @@ DefineExternalRelation(CreateExternalStmt *createExtStmt)
createStmt->tablespacename = NULL;
createStmt->policy = createExtStmt->policy; /* policy was set in transform */
-
+ bool isCustom = false;
switch(exttypeDesc->exttabletype)
{
case EXTTBL_TYPE_LOCATION:
/* Parse and validate URI strings (LOCATION clause) */
locationUris = transformLocationUris(exttypeDesc->location_list,
- createExtStmt->formatOpts,
- isweb, iswritable);
- int locLength = list_length(exttypeDesc->location_list);
- if (createStmt->policy && locLength > 0)
- {
- createStmt->policy->bucketnum = locLength;
+ createExtStmt->formatOpts,
+ isweb, iswritable,&isCustom);
+ if(!isCustom){
+ int locLength = list_length(exttypeDesc->location_list);
+ if (createStmt->policy && locLength > 0)
+ {
+ createStmt->policy->bucketnum = locLength;
+ }
}
break;
@@ -17427,7 +17429,7 @@ AtEOSubXact_on_commit_actions(bool isCommit, SubTransactionId mySubid,
* The result is a text array but we declare it as Datum to avoid
* including array.h in analyze.h.
*/
-static Datum transformLocationUris(List *locs, List* fmtopts, bool isweb, bool iswritable)
+static Datum transformLocationUris(List *locs, List* fmtopts, bool isweb, bool iswritable, bool* isCustom)
{
ListCell *cell;
ArrayBuildState *astate;
@@ -17552,6 +17554,9 @@ static Datum transformLocationUris(List *locs, List* fmtopts, bool isweb, bool i
{
first_protocol = uri->protocol;
first_uri = false;
+ if(uri->protocol == URI_CUSTOM){
+ *isCustom = true;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/db281d5f/src/backend/postmaster/identity.c
----------------------------------------------------------------------
diff --git a/src/backend/postmaster/identity.c b/src/backend/postmaster/identity.c
index 02a2038..a17958b 100644
--- a/src/backend/postmaster/identity.c
+++ b/src/backend/postmaster/identity.c
@@ -562,7 +562,7 @@ GetQueryVsegNum(void)
int
GetExternalTablePartitionNum(void)
{
- return GetQueryVsegNum();
+ return GetHashDistPartitionNum();
}
int