提交 7ef8b5eb 编写于 作者: O obdev 提交者: ob-robot

Placeholder for Lob SQL

上级 59df2a1a
......@@ -878,3 +878,6 @@ PCODE_DEF(OB_GAIS_CLEAR_AUTO_INC_CACHE, 0x1554)
// PCODE_DEF(OB_CHECK_SERVER_HAS_TENANT_UNIT, 0x1555)
PCODE_DEF(OB_SYNC_REWRITE_RULES, 0x1556)
PCODE_DEF(OB_ADMIN_SYNC_REWRITE_RULES, 0x1557)
// 1561-1570 for lob access
PCODE_DEF(OB_LOB_QUERY, 0x1561)
......@@ -21969,6 +21969,18 @@ static const _error _error_OB_ERR_NAME_HAS_TOO_MANY_PARTS = {
.oracle_str_error = "ORA-06563: name has too many parts",
.oracle_str_user_error = "ORA-06563: name has too many parts"
};
static const _error _error_OB_ERR_LOB_SPAN_TRANSACTION = {
.error_name = "OB_ERR_LOB_SPAN_TRANSACTION",
.error_cause = "Internal Error",
.error_solution = "Contact OceanBase Support",
.mysql_errno = -1,
.sqlstate = "HY000",
.str_error = "LOB locators cannot span transactions",
.str_user_error = "LOB locators cannot span transactions",
.oracle_errno = 22990,
.oracle_str_error = "ORA-22990: LOB locators cannot span transactions",
.oracle_str_user_error = "ORA-22990: LOB locators cannot span transactions"
};
static const _error _error_OB_SP_RAISE_APPLICATION_ERROR = {
.error_name = "OB_SP_RAISE_APPLICATION_ERROR",
.error_cause = "Internal Error",
......@@ -23889,6 +23901,7 @@ struct ObStrErrorInit
_errors[-OB_ERR_MISSING_INTO_KEYWORD] = &_error_OB_ERR_MISSING_INTO_KEYWORD;
_errors[-OB_ERR_CLAUSE_RETURN_ILLEGAL] = &_error_OB_ERR_CLAUSE_RETURN_ILLEGAL;
_errors[-OB_ERR_NAME_HAS_TOO_MANY_PARTS] = &_error_OB_ERR_NAME_HAS_TOO_MANY_PARTS;
_errors[-OB_ERR_LOB_SPAN_TRANSACTION] = &_error_OB_ERR_LOB_SPAN_TRANSACTION;
_errors[-OB_SP_RAISE_APPLICATION_ERROR] = &_error_OB_SP_RAISE_APPLICATION_ERROR;
_errors[-OB_SP_RAISE_APPLICATION_ERROR_NUM] = &_error_OB_SP_RAISE_APPLICATION_ERROR_NUM;
_errors[-OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN] = &_error_OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN;
......@@ -2024,6 +2024,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_STATEMENT_STRING_IN_EXECUTE_IMMEDIATE_IS_NULL_OR_ZERO
DEFINE_ORACLE_ERROR(OB_ERR_MISSING_INTO_KEYWORD, -9712, -1, "HY000", "missing INTO keyword", 925, "missing INTO keyword");
DEFINE_ORACLE_ERROR(OB_ERR_CLAUSE_RETURN_ILLEGAL, -9713, -1, "HY000", "RETURNING clause must be used with INSERT, UPDATE, or DELETE statements", 6547, "RETURNING clause must be used with INSERT, UPDATE, or DELETE statements");
DEFINE_ORACLE_ERROR(OB_ERR_NAME_HAS_TOO_MANY_PARTS, -9714, -1, "HY000", "name has too many parts", 6563, "name has too many parts");
DEFINE_ORACLE_ERROR(OB_ERR_LOB_SPAN_TRANSACTION, -9715, -1, "HY000", "LOB locators cannot span transactions", 22990, "LOB locators cannot span transactions");
////////////////////////////////////////////////////////////////
// !!! text/blob || clob/blob erro code
// for compat we cant not remove this errno!!!!
......
......@@ -1597,6 +1597,7 @@ constexpr int OB_ERR_STATEMENT_STRING_IN_EXECUTE_IMMEDIATE_IS_NULL_OR_ZERO_LENGT
constexpr int OB_ERR_MISSING_INTO_KEYWORD = -9712;
constexpr int OB_ERR_CLAUSE_RETURN_ILLEGAL = -9713;
constexpr int OB_ERR_NAME_HAS_TOO_MANY_PARTS = -9714;
constexpr int OB_ERR_LOB_SPAN_TRANSACTION = -9715;
constexpr int OB_SP_RAISE_APPLICATION_ERROR = -20000;
constexpr int OB_SP_RAISE_APPLICATION_ERROR_NUM = -21000;
constexpr int OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN = -22998;
......@@ -3436,6 +3437,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_MISSING_INTO_KEYWORD__USER_ERROR_MSG "missing INTO keyword"
#define OB_ERR_CLAUSE_RETURN_ILLEGAL__USER_ERROR_MSG "RETURNING clause must be used with INSERT, UPDATE, or DELETE statements"
#define OB_ERR_NAME_HAS_TOO_MANY_PARTS__USER_ERROR_MSG "name has too many parts"
#define OB_ERR_LOB_SPAN_TRANSACTION__USER_ERROR_MSG "LOB locators cannot span transactions"
#define OB_SP_RAISE_APPLICATION_ERROR__USER_ERROR_MSG "%.*s"
#define OB_SP_RAISE_APPLICATION_ERROR_NUM__USER_ERROR_MSG "error number argument to raise_application_error of '%d' is out of range"
#define OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN__USER_ERROR_MSG "CLOB or NCLOB in multibyte character set not supported"
......@@ -5275,6 +5277,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_MISSING_INTO_KEYWORD__ORA_USER_ERROR_MSG "ORA-00925: missing INTO keyword"
#define OB_ERR_CLAUSE_RETURN_ILLEGAL__ORA_USER_ERROR_MSG "ORA-06547: RETURNING clause must be used with INSERT, UPDATE, or DELETE statements"
#define OB_ERR_NAME_HAS_TOO_MANY_PARTS__ORA_USER_ERROR_MSG "ORA-06563: name has too many parts"
#define OB_ERR_LOB_SPAN_TRANSACTION__ORA_USER_ERROR_MSG "ORA-22990: LOB locators cannot span transactions"
#define OB_SP_RAISE_APPLICATION_ERROR__ORA_USER_ERROR_MSG "ORA%06ld: %.*s"
#define OB_SP_RAISE_APPLICATION_ERROR_NUM__ORA_USER_ERROR_MSG "ORA-21000: error number argument to raise_application_error of '%d' is out of range"
#define OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN__ORA_USER_ERROR_MSG "ORA-22998: CLOB or NCLOB in multibyte character set not supported"
......
......@@ -240,6 +240,7 @@ enum ObSysVarClassType
SYS_VAR__WINDOWFUNC_OPTIMIZATION_SETTINGS = 10133,
SYS_VAR_OB_ENABLE_RICH_ERROR_MSG = 10134,
SYS_VAR_OB_SQL_PLAN_MEMORY_PERCENTAGE = 10135,
SYS_VAR_LOG_ROW_VALUE_OPTIONS = 10136,
};
}
......
......@@ -1966,6 +1966,27 @@ int ObSysVarOnCheckFuncs::check_update_resource_manager_plan(ObExecContext &ctx,
return ret;
}
int ObSysVarOnCheckFuncs::check_log_row_value_option_is_valid(sql::ObExecContext &ctx,
const ObSetVar &set_var,
const ObBasicSysVar &sys_var,
const common::ObObj &in_val,
common::ObObj &out_val)
{
int ret = OB_SUCCESS;
ObString val = in_val.get_string();
if (!val.empty()) {
if (val.case_compare("partial_lob") != 0) {
ret = OB_ERR_PARAM_VALUE_INVALID;
LOG_USER_ERROR(OB_ERR_PARAM_VALUE_INVALID);
} else {
out_val = in_val;
}
} else {
out_val = in_val;
}
return ret;
}
bool ObSysVarOnCheckFuncs::can_set_trans_var(ObSetVar::SetScopeType scope,
ObBasicSessionInfo &session)
{
......
......@@ -888,6 +888,11 @@ public:
const ObBasicSysVar &sys_var,
const common::ObObj &val,
common::ObObj &out_val);
static int check_log_row_value_option_is_valid(sql::ObExecContext &ctx,
const ObSetVar &set_var,
const ObBasicSysVar &sys_var,
const common::ObObj &in_val,
common::ObObj &out_val);
private:
static int check_session_readonly(sql::ObExecContext &ctx,
const ObSetVar &set_var,
......
......@@ -235,6 +235,7 @@ namespace share
static const char* const OB_SV__WINDOWFUNC_OPTIMIZATION_SETTINGS = "_windowfunc_optimization_settings";
static const char* const OB_SV_ENABLE_RICH_ERROR_MSG = "ob_enable_rich_error_msg";
static const char* const OB_SV_SQL_PLAN_MEMORY_PERCENTAGE = "ob_sql_plan_memory_percentage";
static const char* const OB_SV_LOG_ROW_VALUE_OPTIONS = "log_row_value_options";
}
}
......
......@@ -197,6 +197,7 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_NAME[] = {
"local_infile",
"lock_wait_timeout",
"log_bin",
"log_row_value_options",
"long_query_time",
"lower_case_table_names",
"max_allowed_packet",
......@@ -419,6 +420,7 @@ const ObSysVarClassType ObSysVarFactory::SYS_VAR_IDS_SORTED_BY_NAME[] = {
SYS_VAR_LOCAL_INFILE,
SYS_VAR_LOCK_WAIT_TIMEOUT,
SYS_VAR_LOG_BIN,
SYS_VAR_LOG_ROW_VALUE_OPTIONS,
SYS_VAR_LONG_QUERY_TIME,
SYS_VAR_LOWER_CASE_TABLE_NAMES,
SYS_VAR_MAX_ALLOWED_PACKET,
......@@ -780,7 +782,8 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_ID[] = {
"innodb_strict_mode",
"_windowfunc_optimization_settings",
"ob_enable_rich_error_msg",
"ob_sql_plan_memory_percentage"
"ob_sql_plan_memory_percentage",
"log_row_value_options"
};
bool ObSysVarFactory::sys_var_name_case_cmp(const char *name1, const ObString &name2)
......@@ -1167,6 +1170,7 @@ int ObSysVarFactory::create_all_sys_vars()
+ sizeof(ObSysVarWindowfuncOptimizationSettings)
+ sizeof(ObSysVarObEnableRichErrorMsg)
+ sizeof(ObSysVarObSqlPlanMemoryPercentage)
+ sizeof(ObSysVarLogRowValueOptions)
;
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(total_mem_size))) {
......@@ -3146,6 +3150,15 @@ int ObSysVarFactory::create_all_sys_vars()
ptr = (void *)((char *)ptr + sizeof(ObSysVarObSqlPlanMemoryPercentage));
}
}
if (OB_SUCC(ret)) {
if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarLogRowValueOptions())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarLogRowValueOptions", K(ret));
} else {
store_buf_[ObSysVarsToIdxMap::get_store_idx(static_cast<int64_t>(SYS_VAR_LOG_ROW_VALUE_OPTIONS))] = sys_var_ptr;
ptr = (void *)((char *)ptr + sizeof(ObSysVarLogRowValueOptions));
}
}
}
return ret;
......@@ -5581,6 +5594,17 @@ int ObSysVarFactory::create_sys_var(ObSysVarClassType sys_var_id, ObBasicSysVar
}
break;
}
case SYS_VAR_LOG_ROW_VALUE_OPTIONS: {
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(sizeof(ObSysVarLogRowValueOptions)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to alloc memory", K(ret), K(sizeof(ObSysVarLogRowValueOptions)));
} else if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarLogRowValueOptions())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarLogRowValueOptions", K(ret));
}
break;
}
default: {
ret = OB_ERR_UNEXPECTED;
......
......@@ -1584,6 +1584,13 @@ public:
inline virtual ObSysVarClassType get_type() const { return SYS_VAR_OB_SQL_PLAN_MEMORY_PERCENTAGE; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(218); }
};
class ObSysVarLogRowValueOptions : public ObVarcharSysVar
{
public:
ObSysVarLogRowValueOptions() : ObVarcharSysVar(ObSysVarOnCheckFuncs::check_log_row_value_option_is_valid, NULL, NULL, NULL, NULL) {}
inline virtual ObSysVarClassType get_type() const { return SYS_VAR_LOG_ROW_VALUE_OPTIONS; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(219); }
};
class ObSysVarFactory
......@@ -1603,7 +1610,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 = 122;
const static int64_t OB_SYS_VARS_COUNT = 123;
const static int64_t ALL_SYS_VARS_COUNT = MYSQL_SYS_VARS_COUNT + OB_SYS_VARS_COUNT;
const static int16_t OB_SPECIFIC_SYS_VAR_ID_OFFSET = 10000;
......
......@@ -2879,13 +2879,26 @@ static struct VarsInit{
ObSysVars[218].alias_ = "OB_SV_SQL_PLAN_MEMORY_PERCENTAGE" ;
}();
[&] (){
ObSysVars[219].info_ = "control whether lob use partial update" ;
ObSysVars[219].name_ = "log_row_value_options" ;
ObSysVars[219].data_type_ = ObVarcharType ;
ObSysVars[219].value_ = "" ;
ObSysVars[219].flags_ = ObSysVarFlag::GLOBAL_SCOPE | ObSysVarFlag::SESSION_SCOPE ;
ObSysVars[219].on_check_and_convert_func_ = "ObSysVarOnCheckFuncs::check_log_row_value_option_is_valid" ;
ObSysVars[219].id_ = SYS_VAR_LOG_ROW_VALUE_OPTIONS ;
cur_max_var_id = MAX(cur_max_var_id, static_cast<int64_t>(SYS_VAR_LOG_ROW_VALUE_OPTIONS)) ;
ObSysVarsIdToArrayIdx[SYS_VAR_LOG_ROW_VALUE_OPTIONS] = 219 ;
ObSysVars[219].alias_ = "OB_SV_LOG_ROW_VALUE_OPTIONS" ;
}();
if (cur_max_var_id >= ObSysVarFactory::OB_MAX_SYS_VAR_ID) {
HasInvalidSysVar = true;
}
}
}vars_init;
static int64_t var_amount = 219;
static int64_t var_amount = 220;
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_;}
......
......@@ -2908,5 +2908,18 @@
"info_cn": "",
"background_cn": "",
"ref_url": ""
},
"log_row_value_options": {
"id": 10136,
"name": "log_row_value_options",
"value": "",
"data_type": "varchar",
"info": "control whether lob use partial update",
"flags": "Global | SESSION",
"on_check_and_convert_func": "ObSysVarOnCheckFuncs::check_log_row_value_option_is_valid",
"publish_version": "",
"info_cn": "",
"background_cn": "",
"ref_url": "https://yuque.antfin-inc.com/ob/product_functionality_review/wan7iw4mox8vgkfm"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册