fix online stat gather plan bug
This commit is contained in:
parent
1ab2101f69
commit
6c172afeae
@ -1179,7 +1179,9 @@ int ObDelUpdLogPlan::create_pdml_insert_plan(ObLogicalOperator *&top,
|
||||
} else if (OB_FAIL(allocate_exchange_as_top(top, exch_info))) {
|
||||
LOG_WARN("failed to allocate exchange as top", K(ret));
|
||||
} else if (osg_info != NULL &&
|
||||
OB_FAIL(allocate_optimizer_stats_gathering_as_top(top, *osg_info))) {
|
||||
OB_FAIL(allocate_optimizer_stats_gathering_as_top(top,
|
||||
*osg_info,
|
||||
OSG_TYPE::GATHER_OSG))) {
|
||||
LOG_WARN("failed to allocate optimizer stats gathering");
|
||||
} else if (OB_FAIL(allocate_pdml_insert_as_top(top,
|
||||
is_index_maintenance,
|
||||
@ -1194,7 +1196,8 @@ int ObDelUpdLogPlan::create_pdml_insert_plan(ObLogicalOperator *&top,
|
||||
}
|
||||
|
||||
int ObDelUpdLogPlan::allocate_optimizer_stats_gathering_as_top(ObLogicalOperator *&old_top,
|
||||
OSGShareInfo &info)
|
||||
OSGShareInfo &info,
|
||||
OSG_TYPE type)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObLogOptimizerStatsGathering *osg = NULL;
|
||||
@ -1206,8 +1209,6 @@ int ObDelUpdLogPlan::allocate_optimizer_stats_gathering_as_top(ObLogicalOperator
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("failed to allocate sequence operator", K(ret));
|
||||
} else {
|
||||
OSG_TYPE type = old_top->need_osg_merge() ? OSG_TYPE::MERGE_OSG :
|
||||
old_top->is_sharding() ? OSG_TYPE::GATHER_OSG : OSG_TYPE::NORMAL_OSG;
|
||||
osg->set_child(ObLogicalOperator::first_child, old_top);
|
||||
osg->set_osg_type(type);
|
||||
osg->set_table_id(info.table_id_);
|
||||
|
@ -245,7 +245,8 @@ protected:
|
||||
virtual int generate_normal_raw_plan() override;
|
||||
virtual int generate_dblink_raw_plan() override;
|
||||
int allocate_optimizer_stats_gathering_as_top(ObLogicalOperator *&old_top,
|
||||
OSGShareInfo &info);
|
||||
OSGShareInfo &info,
|
||||
OSG_TYPE type);
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObDelUpdLogPlan);
|
||||
|
||||
|
@ -498,6 +498,31 @@ int ObInsertLogPlan::build_lock_row_flag_expr(ObConstRawExpr *&lock_row_flag_exp
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInsertLogPlan::get_osg_type(bool is_multi_part_dml,
|
||||
ObShardingInfo *insert_table_sharding,
|
||||
int64_t distributed_method,
|
||||
OSG_TYPE &type)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
type = OSG_TYPE::NORMAL_OSG;
|
||||
if (DIST_PARTITION_WISE == distributed_method ||
|
||||
DIST_PULL_TO_LOCAL == distributed_method) {
|
||||
//need merge stats
|
||||
type = OSG_TYPE::GATHER_OSG;
|
||||
} else if (DIST_BASIC_METHOD == distributed_method) {
|
||||
if (is_multi_part_dml) {
|
||||
type = OSG_TYPE::NORMAL_OSG;
|
||||
} else if (OB_ISNULL(insert_table_sharding)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpect null sharding", K(ret));
|
||||
} else if (insert_table_sharding->is_remote()) {
|
||||
//need merge stats
|
||||
type = OSG_TYPE::GATHER_OSG;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInsertLogPlan::create_insert_plans(ObIArray<CandidatePlan> &candi_plans,
|
||||
ObTablePartitionInfo *insert_table_part,
|
||||
ObShardingInfo *insert_table_sharding,
|
||||
@ -511,6 +536,7 @@ int ObInsertLogPlan::create_insert_plans(ObIArray<CandidatePlan> &candi_plans,
|
||||
ObExchangeInfo exch_info;
|
||||
bool is_multi_part_dml = false;
|
||||
CandidatePlan candi_plan;
|
||||
OSG_TYPE osg_type = OSG_TYPE::NORMAL_OSG;
|
||||
int64_t inherit_sharding_index = OB_INVALID_INDEX;
|
||||
ObShardingInfo *insert_op_sharding = NULL;
|
||||
ObSEArray<ObShardingInfo*, 2> input_shardings;
|
||||
@ -533,9 +559,16 @@ int ObInsertLogPlan::create_insert_plans(ObIArray<CandidatePlan> &candi_plans,
|
||||
LOG_WARN("failed to get best insert plan method", K(ret));
|
||||
} else if (0 == distributed_methods) {
|
||||
/*do nothing*/
|
||||
} else if (osg_info != NULL &&
|
||||
OB_FAIL(get_osg_type(is_multi_part_dml,
|
||||
insert_table_sharding,
|
||||
distributed_methods,
|
||||
osg_type))) {
|
||||
LOG_WARN("failed to get osg type", K(ret));
|
||||
} else if (osg_info != NULL &&
|
||||
OB_FAIL(allocate_optimizer_stats_gathering_as_top(candi_plan.plan_tree_,
|
||||
*osg_info))) {
|
||||
*osg_info,
|
||||
osg_type))) {
|
||||
LOG_WARN("failed to allocate sequence as top", K(ret));
|
||||
} else if (DIST_PULL_TO_LOCAL == distributed_methods) {
|
||||
if (OB_FAIL(allocate_exchange_as_top(candi_plan.plan_tree_, exch_info))) {
|
||||
@ -1598,7 +1631,8 @@ int ObInsertLogPlan::candi_allocate_optimizer_stats_merge(OSGShareInfo *osg_info
|
||||
LOG_WARN("failed to allocate exchange as top", K(ret));
|
||||
} else if (OB_FAIL(allocate_optimizer_stats_gathering_as_top(
|
||||
best_candidates.at(i).plan_tree_,
|
||||
*osg_info))) {
|
||||
*osg_info,
|
||||
OSG_TYPE::MERGE_OSG))) {
|
||||
LOG_WARN("failed to allocate sequence as top", K(ret));
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,11 @@ protected:
|
||||
int candi_allocate_pdml_insert(OSGShareInfo *osg_info);
|
||||
int candi_allocate_optimizer_stats_merge(OSGShareInfo *osg_info);
|
||||
|
||||
int get_osg_type(bool is_multi_part_dml,
|
||||
ObShardingInfo *insert_table_sharding,
|
||||
int64_t distributed_method,
|
||||
OSG_TYPE &type);
|
||||
|
||||
virtual int get_best_insert_dist_method(ObLogicalOperator &top,
|
||||
ObTablePartitionInfo *insert_table_partition,
|
||||
ObShardingInfo *insert_table_sharding,
|
||||
|
Loading…
x
Reference in New Issue
Block a user