[CP] [to #2024080100104015178] fix: move sysvar AUTOCOMMIT check for arraybinding after sessoin info synchronization

This commit is contained in:
haohao022 2024-08-23 14:56:32 +00:00 committed by ob-robot
parent e48a0f2d22
commit 8074d8588a
2 changed files with 16 additions and 10 deletions

View File

@ -281,9 +281,7 @@ int ObMPStmtExecute::init_for_arraybinding(ObIAllocator &alloc)
return ret;
}
int ObMPStmtExecute::check_param_type_for_arraybinding(
ObSQLSessionInfo *session_info,
ParamTypeInfoArray &param_type_infos)
int ObMPStmtExecute::check_precondition_for_arraybinding(const ObSQLSessionInfo &session_info)
{
int ret = OB_SUCCESS;
if (!ObStmt::is_dml_write_stmt(stmt_type_)
@ -292,11 +290,18 @@ int ObMPStmtExecute::check_param_type_for_arraybinding(
ret = OB_NOT_SUPPORTED;
LOG_WARN("arraybinding only support write dml", K(ret), K(stmt_type_));
LOG_USER_ERROR(OB_NOT_SUPPORTED, "arraybinding got no write dml");
} else if (session_info->get_local_autocommit()) {
} else if (session_info.get_local_autocommit()) { // read system variable after session info synchronized
ret = OB_NOT_SUPPORTED;
LOG_WARN("arraybinding must in autocommit off", K(ret));
LOG_USER_ERROR(OB_NOT_SUPPORTED, "arraybinding has autocommit = on");
} else if (OB_UNLIKELY(param_type_infos.count() <= 0)) {
}
return ret;
}
int ObMPStmtExecute::check_param_type_for_arraybinding(ParamTypeInfoArray &param_type_infos)
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(param_type_infos.count() <= 0)) {
ret = OB_NOT_SUPPORTED;
LOG_WARN("arraybinding must has parameters", K(ret));
LOG_USER_ERROR(OB_NOT_SUPPORTED, "arraybinding has no parameter");
@ -306,8 +311,7 @@ int ObMPStmtExecute::check_param_type_for_arraybinding(
if (type_info.is_basic_type_ || !type_info.is_elem_type_) {
ret = OB_NOT_SUPPORTED;
LOG_WARN("arraybinding parameter must be anonymous array", K(ret));
LOG_USER_ERROR(OB_NOT_SUPPORTED,
"arraybinding parameter is not anonymous array");
LOG_USER_ERROR(OB_NOT_SUPPORTED, "arraybinding parameter is not anonymous array");
}
}
}
@ -1000,7 +1004,7 @@ int ObMPStmtExecute::request_params(ObSQLSessionInfo *session,
}
if (OB_SUCC(ret) && is_arraybinding_) {
OZ (check_param_type_for_arraybinding(session, param_type_infos));
OZ (check_param_type_for_arraybinding(param_type_infos));
}
if (OB_SUCC(ret)
&& (stmt::T_CALL_PROCEDURE == ps_session_info->get_stmt_type()
@ -1964,6 +1968,8 @@ int ObMPStmtExecute::process()
LOG_WARN("failed to init flt extra info", K(ret));
} else if (OB_FAIL(session.gen_configs_in_pc_str())) {
LOG_WARN("fail to generate configuration string that can influence execution plan", K(ret));
} else if (is_arraybinding_ && OB_FAIL(check_precondition_for_arraybinding(session))) {
LOG_WARN("precondition for arraybinding is not satisfied", K(ret));
} else {
FLTSpanGuard(ps_execute);
FLT_SET_TAG(log_trace_id, ObCurTraceId::get_trace_id_str(),

View File

@ -264,8 +264,8 @@ private:
int init_arraybinding_field(int64_t column_field_cnt, const ColumnsFieldIArray *column_fields);
int init_row_for_arraybinding(ObIAllocator &alloc, int64_t array_binding_row_num);
int check_param_type_for_arraybinding(
sql::ObSQLSessionInfo *session_info, sql::ParamTypeInfoArray &param_type_infos);
int check_precondition_for_arraybinding(const ObSQLSessionInfo &session_info);
int check_param_type_for_arraybinding(sql::ParamTypeInfoArray &param_type_infos);
int check_param_value_for_arraybinding(ObObjParam &param);
int construct_execute_param_for_arraybinding(int64_t pos);
void reset_complex_param_memory(ParamStore *params, sql::ObSQLSessionInfo *session_info = nullptr);