[part-2] Split plan memory to tenants

This commit is contained in:
obdev
2023-06-02 04:11:57 +00:00
committed by ob-robot
parent a7e3b054fd
commit 0e941a7b37
5 changed files with 25 additions and 13 deletions

View File

@ -777,9 +777,11 @@ int ObPhysicalPlan::set_table_locations(const ObTablePartitionInfoArray &infos,
int ret = OB_SUCCESS;
table_locations_.reset();
das_table_locations_.reset();
if (OB_FAIL(table_locations_.init(infos.count()))) {
if (OB_FAIL(table_locations_.prepare_allocate_and_keep_count(infos.count(),
allocator_))) {
LOG_WARN("fail to init table location count", K(ret));
} else if (OB_FAIL(das_table_locations_.init(infos.count()))) {
} else if (OB_FAIL(das_table_locations_.prepare_allocate_and_keep_count(infos.count(),
allocator_))) {
LOG_WARN("fail to init das table location count", K(ret));
}
for (int64_t i = 0; OB_SUCC(ret) && i < infos.count(); ++i) {

View File

@ -48,7 +48,6 @@ namespace sql
{
ObPlanSet::~ObPlanSet()
{
// Make sure destory planset before destory pre calculable expression.
if (OB_ISNULL(pre_cal_expr_handler_)) {
// have no pre calculable expression, do nothing
@ -1186,7 +1185,7 @@ int ObSqlPlanSet::add_plan(ObPhysicalPlan &plan,
} else {
if (OB_FAIL(add_physical_plan(OB_PHY_PLAN_LOCAL, pc_ctx, plan))) {
SQL_PC_LOG(TRACE, "fail to add local plan", K(ret));
} else if (OB_SUCC(ret)
} else if (OB_SUCC(ret)
&& FALSE_IT(direct_local_plan_ = &plan)) {
// do nothing
} else {
@ -1281,6 +1280,9 @@ int ObSqlPlanSet::init_new_set(const ObPlanCacheCtx &pc_ctx,
LOG_WARN("pc_allocator has not been initialized.", K(ret));
} else if (OB_FAIL(ObPlanSet::init_new_set(pc_ctx, plan, outline_param_idx, pc_malloc_))) {
LOG_WARN("init new set failed", K(ret));
} else if (OB_FAIL(table_locations_.prepare_allocate_and_keep_count(sql_ctx.partition_infos_.count(),
*plan_cache_value_->get_pcv_set()->get_allocator()))) {
LOG_WARN("fail to init table location count", K(ret));
} else if (OB_FAIL(dist_plans_.init(this))) {
SQL_PC_LOG(WARN, "failed to init dist plans", K(ret));
} else {
@ -1648,7 +1650,7 @@ int ObSqlPlanSet::get_plan_normal(ObPlanCacheCtx &pc_ctx,
int ObSqlPlanSet::try_get_local_plan(ObPlanCacheCtx &pc_ctx,
ObPhysicalPlan *&plan,
ObPhysicalPlan *&plan,
bool &get_next)
{
int ret = OB_SUCCESS;
@ -1678,7 +1680,7 @@ int ObSqlPlanSet::try_get_local_plan(ObPlanCacheCtx &pc_ctx,
}
int ObSqlPlanSet::try_get_remote_plan(ObPlanCacheCtx &pc_ctx,
ObPhysicalPlan *&plan,
ObPhysicalPlan *&plan,
bool &get_next)
{
int ret = OB_SUCCESS;

View File

@ -250,7 +250,7 @@ public:
ObSqlPlanSet()
: ObPlanSet(PST_SQL_CRSR),
is_all_non_partition_(true),
table_locations_(), // use default behavior for memory release
table_locations_(alloc_),
array_binding_plan_(),
local_plan_(NULL),
remote_plan_(NULL),
@ -262,7 +262,6 @@ public:
is_contain_virtual_table_(false),
enable_inner_part_parallel_exec_(false)
{
table_locations_.set_attr(ObMemAttr(OB_SERVER_TENANT_ID, "TableLocations"));
}
virtual ~ObSqlPlanSet() {}
@ -357,7 +356,7 @@ private:
bool is_local_plan_opt_allowed(int last_retry_err);
private:
bool is_all_non_partition_; //判断该plan对应的表是否均为非分区表
common::ObSEArray<ObTableLocation, 1> table_locations_;
TableLocationFixedArray table_locations_;
//used for array binding, only local plan
ObPhysicalPlan *array_binding_plan_;
ObPhysicalPlan *local_plan_;