add place holder of system variable

This commit is contained in:
hanr881
2023-11-01 11:09:21 +00:00
committed by ob-robot
parent 8cf16317ae
commit 730c9fa296
6 changed files with 62 additions and 3 deletions

View File

@ -260,6 +260,7 @@ enum ObSysVarClassType
SYS_VAR_PRIVILEGE_FEATURES_ENABLE = 10154,
SYS_VAR__PRIV_CONTROL = 10155,
SYS_VAR__ENABLE_MYSQL_PL_PRIV_CHECK = 10156,
SYS_VAR_OB_ENABLE_PL_CACHE = 10157,
};
}

View File

@ -255,6 +255,7 @@ namespace share
static const char* const OB_SV_PRIVILEGE_FEATURES_ENABLE = "privilege_features_enable";
static const char* const OB_SV__PRIV_CONTROL = "_priv_control";
static const char* const OB_SV__ENABLE_MYSQL_PL_PRIV_CHECK = "_enable_mysql_pl_priv_check";
static const char* const OB_SV_ENABLE_PL_CACHE = "ob_enable_pl_cache";
}
}

View File

@ -247,6 +247,7 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_NAME[] = {
"ob_enable_aggregation_pushdown",
"ob_enable_index_direct_select",
"ob_enable_jit",
"ob_enable_pl_cache",
"ob_enable_plan_cache",
"ob_enable_rich_error_msg",
"ob_enable_show_trace",
@ -489,6 +490,7 @@ const ObSysVarClassType ObSysVarFactory::SYS_VAR_IDS_SORTED_BY_NAME[] = {
SYS_VAR_OB_ENABLE_AGGREGATION_PUSHDOWN,
SYS_VAR_OB_ENABLE_INDEX_DIRECT_SELECT,
SYS_VAR_OB_ENABLE_JIT,
SYS_VAR_OB_ENABLE_PL_CACHE,
SYS_VAR_OB_ENABLE_PLAN_CACHE,
SYS_VAR_OB_ENABLE_RICH_ERROR_MSG,
SYS_VAR_OB_ENABLE_SHOW_TRACE,
@ -845,7 +847,8 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_ID[] = {
"automatic_sp_privileges",
"privilege_features_enable",
"_priv_control",
"_enable_mysql_pl_priv_check"
"_enable_mysql_pl_priv_check",
"ob_enable_pl_cache"
};
bool ObSysVarFactory::sys_var_name_case_cmp(const char *name1, const ObString &name2)
@ -1253,6 +1256,7 @@ int ObSysVarFactory::create_all_sys_vars()
+ sizeof(ObSysVarPrivilegeFeaturesEnable)
+ sizeof(ObSysVarPrivControl)
+ sizeof(ObSysVarEnableMysqlPlPrivCheck)
+ sizeof(ObSysVarObEnablePlCache)
;
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(total_mem_size))) {
@ -3412,6 +3416,15 @@ int ObSysVarFactory::create_all_sys_vars()
ptr = (void *)((char *)ptr + sizeof(ObSysVarEnableMysqlPlPrivCheck));
}
}
if (OB_SUCC(ret)) {
if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarObEnablePlCache())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarObEnablePlCache", K(ret));
} else {
store_buf_[ObSysVarsToIdxMap::get_store_idx(static_cast<int64_t>(SYS_VAR_OB_ENABLE_PL_CACHE))] = sys_var_ptr;
ptr = (void *)((char *)ptr + sizeof(ObSysVarObEnablePlCache));
}
}
}
return ret;
@ -6051,6 +6064,17 @@ int ObSysVarFactory::create_sys_var(ObIAllocator &allocator_, ObSysVarClassType
}
break;
}
case SYS_VAR_OB_ENABLE_PL_CACHE: {
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(sizeof(ObSysVarObEnablePlCache)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to alloc memory", K(ret), K(sizeof(ObSysVarObEnablePlCache)));
} else if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarObEnablePlCache())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarObEnablePlCache", K(ret));
}
break;
}
default: {
ret = OB_ERR_UNEXPECTED;

View File

@ -1726,6 +1726,13 @@ public:
inline virtual ObSysVarClassType get_type() const { return SYS_VAR__ENABLE_MYSQL_PL_PRIV_CHECK; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(238); }
};
class ObSysVarObEnablePlCache : public ObBoolSysVar
{
public:
ObSysVarObEnablePlCache() : ObBoolSysVar(NULL, NULL, NULL, NULL, NULL) {}
inline virtual ObSysVarClassType get_type() const { return SYS_VAR_OB_ENABLE_PL_CACHE; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(239); }
};
class ObSysVarFactory
@ -1746,7 +1753,7 @@ public:
static const common::ObString get_sys_var_name_by_id(ObSysVarClassType sys_var_id);
const static int64_t MYSQL_SYS_VARS_COUNT = 97;
const static int64_t OB_SYS_VARS_COUNT = 142;
const static int64_t OB_SYS_VARS_COUNT = 143;
const static int64_t ALL_SYS_VARS_COUNT = MYSQL_SYS_VARS_COUNT + OB_SYS_VARS_COUNT;
const static int64_t INVALID_MAX_READ_STALE_TIME = -1;

View File

@ -3375,13 +3375,26 @@ static struct VarsInit{
ObSysVars[238].alias_ = "OB_SV__ENABLE_MYSQL_PL_PRIV_CHECK" ;
}();
[&] (){
ObSysVars[239].default_value_ = "1" ;
ObSysVars[239].info_ = "whether use pl cache in session" ;
ObSysVars[239].name_ = "ob_enable_pl_cache" ;
ObSysVars[239].data_type_ = ObIntType ;
ObSysVars[239].flags_ = ObSysVarFlag::GLOBAL_SCOPE | ObSysVarFlag::SESSION_SCOPE | ObSysVarFlag::NEED_SERIALIZE ;
ObSysVars[239].id_ = SYS_VAR_OB_ENABLE_PL_CACHE ;
cur_max_var_id = MAX(cur_max_var_id, static_cast<int64_t>(SYS_VAR_OB_ENABLE_PL_CACHE)) ;
ObSysVarsIdToArrayIdx[SYS_VAR_OB_ENABLE_PL_CACHE] = 239 ;
ObSysVars[239].base_value_ = "1" ;
ObSysVars[239].alias_ = "OB_SV_ENABLE_PL_CACHE" ;
}();
if (cur_max_var_id >= ObSysVarFactory::OB_MAX_SYS_VAR_ID) {
HasInvalidSysVar = true;
}
}
}vars_init;
static int64_t var_amount = 239;
static int64_t var_amount = 240;
int64_t ObSysVariables::get_all_sys_var_count(){ return ObSysVarFactory::ALL_SYS_VARS_COUNT;}
ObSysVarClassType ObSysVariables::get_sys_var_id(int64_t i){ return ObSysVars[i].id_;}

View File

@ -3405,5 +3405,18 @@
"info_cn": "",
"background_cn": "",
"ref_url": ""
},
"ob_enable_pl_cache": {
"id": 10157,
"name": "ob_enable_pl_cache",
"default_value": "1",
"base_value": "1",
"data_type": "bool",
"info": "whether use pl cache in session",
"flags": "GLOBAL | SESSION | NEED_SERIALIZE",
"publish_version": "422",
"info_cn": "",
"background_cn": "",
"ref_url": ""
}
}