add optimzer version control system variable OPTIMIZER_FEATURES_ENABLE

This commit is contained in:
chimyue
2023-07-10 03:41:49 +00:00
committed by ob-robot
parent abb148c4c2
commit 2647aaccd3
9 changed files with 92 additions and 3 deletions

View File

@ -279,6 +279,7 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_NAME[] = {
"ob_trx_timeout",
"optimizer_capture_sql_plan_baselines",
"optimizer_dynamic_sampling",
"optimizer_features_enable",
"optimizer_use_sql_plan_baselines",
"parallel_degree_limit",
"parallel_degree_policy",
@ -514,6 +515,7 @@ const ObSysVarClassType ObSysVarFactory::SYS_VAR_IDS_SORTED_BY_NAME[] = {
SYS_VAR_OB_TRX_TIMEOUT,
SYS_VAR_OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES,
SYS_VAR_OPTIMIZER_DYNAMIC_SAMPLING,
SYS_VAR_OPTIMIZER_FEATURES_ENABLE,
SYS_VAR_OPTIMIZER_USE_SQL_PLAN_BASELINES,
SYS_VAR_PARALLEL_DEGREE_LIMIT,
SYS_VAR_PARALLEL_DEGREE_POLICY,
@ -824,7 +826,8 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_ID[] = {
"runtime_filter_type",
"runtime_filter_wait_time_ms",
"runtime_filter_max_in_num",
"runtime_bloom_filter_max_size"
"runtime_bloom_filter_max_size",
"optimizer_features_enable"
};
bool ObSysVarFactory::sys_var_name_case_cmp(const char *name1, const ObString &name2)
@ -1225,6 +1228,7 @@ int ObSysVarFactory::create_all_sys_vars()
+ sizeof(ObSysVarRuntimeFilterWaitTimeMs)
+ sizeof(ObSysVarRuntimeFilterMaxInNum)
+ sizeof(ObSysVarRuntimeBloomFilterMaxSize)
+ sizeof(ObSysVarOptimizerFeaturesEnable)
;
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(total_mem_size))) {
@ -3321,6 +3325,15 @@ int ObSysVarFactory::create_all_sys_vars()
ptr = (void *)((char *)ptr + sizeof(ObSysVarRuntimeBloomFilterMaxSize));
}
}
if (OB_SUCC(ret)) {
if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarOptimizerFeaturesEnable())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarOptimizerFeaturesEnable", K(ret));
} else {
store_buf_[ObSysVarsToIdxMap::get_store_idx(static_cast<int64_t>(SYS_VAR_OPTIMIZER_FEATURES_ENABLE))] = sys_var_ptr;
ptr = (void *)((char *)ptr + sizeof(ObSysVarOptimizerFeaturesEnable));
}
}
}
return ret;
@ -5883,6 +5896,17 @@ int ObSysVarFactory::create_sys_var(ObIAllocator &allocator_, ObSysVarClassType
}
break;
}
case SYS_VAR_OPTIMIZER_FEATURES_ENABLE: {
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(sizeof(ObSysVarOptimizerFeaturesEnable)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to alloc memory", K(ret), K(sizeof(ObSysVarOptimizerFeaturesEnable)));
} else if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarOptimizerFeaturesEnable())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarOptimizerFeaturesEnable", K(ret));
}
break;
}
default: {
ret = OB_ERR_UNEXPECTED;