add inner_same_as for udf func and remove useless GET_MIN_CLUSTER_VERSION

This commit is contained in:
Larry955
2022-11-16 07:35:39 +00:00
committed by wangzelin.wzl
parent 99d34dc07b
commit 8aee7d972f
34 changed files with 279 additions and 527 deletions

View File

@ -728,11 +728,7 @@ int ObAdminZoneExecutor::execute(ObExecContext &ctx, ObAdminZoneStmt &stmt)
}
} else {} // force stop, no need to wait leader switch
} else if (ObAdminZoneArg::MODIFY == stmt.get_op()) {
if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1440) {
ret = OB_OP_NOT_ALLOW;
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "cannot alter zone during cluster updating to 143");
LOG_INFO("alter zone during cluster upgrading to version 1.4.3");
} else if (OB_FAIL(common_proxy->alter_zone(arg))) {
if (OB_FAIL(common_proxy->alter_zone(arg))) {
LOG_WARN("common rpc proxy alter zone failed", K(arg), K(ret));
}
} else {

View File

@ -53,8 +53,7 @@ int ObAnalyzeExecutor::execute(ObExecContext &ctx, ObAnalyzeStmt &stmt)
in_restore))) {
LOG_WARN("failed to check tenant is restore", K(ret));
} else if (OB_UNLIKELY(in_restore) ||
GCTX.is_standby_cluster() ||
GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3200) {
GCTX.is_standby_cluster()) {
ret = OB_NOT_SUPPORTED;
LOG_USER_ERROR(OB_NOT_SUPPORTED, "analyze table during restore or standby cluster");
} else if (OB_FAIL(stmt.fill_table_stat_param(ctx, param))) {

View File

@ -912,9 +912,6 @@ int ObAlterTableExecutor::execute(ObExecContext &ctx, ObAlterTableStmt &stmt)
|| (obrpc::ObAlterTableArg::ALTER_CONSTRAINT_STATE == alter_table_arg.alter_constraint_type_))) {
if (OB_FAIL(need_check_constraint_validity(alter_table_arg, need_check))) {
LOG_WARN("check whether need check failed", K(ret));
} else if (need_check && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) {
ret = OB_NOT_SUPPORTED;
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Such ddl operation during upgrade");
}
}
// 如果追加 validate 属性的外键或者 modify 外键为 validate 属性时,不立即生效
@ -927,8 +924,7 @@ int ObAlterTableExecutor::execute(ObExecContext &ctx, ObAlterTableStmt &stmt)
need_modify_fk_validate = true;
}
}
if (OB_SUCC(ret)
&& (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100)) {
if (OB_SUCC(ret)) {
if (OB_FAIL(alter_table_rpc_v2(
alter_table_arg,
res,
@ -938,17 +934,6 @@ int ObAlterTableExecutor::execute(ObExecContext &ctx, ObAlterTableStmt &stmt)
is_sync_ddl_user))) {
LOG_WARN("Failed to alter table rpc v2", K(ret));
}
} else if (OB_SUCC(ret)
&& (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100)) {
if (OB_FAIL(alter_table_rpc_v1(
alter_table_arg,
res,
allocator,
common_rpc_proxy,
my_session,
is_sync_ddl_user))) {
LOG_WARN("Failed to alter table rpc v1", K(ret));
}
}
}
}

View File

@ -607,46 +607,21 @@ int ObExprCast::do_implicit_cast(ObExprCtx &expr_ctx,
OB_DEF_SERIALIZE(ObExprCast)
{
int ret = OB_SUCCESS;
bool is_implicit_cast = (1 == extra_serialize_);
// ObExprCast最初没有定义自己的序列化方法,后来在2273中添加了序列化方法,导致序列化buf发生如下变化
// [ObExprOperator_ser_len, ObExprOperator_ser_data] =>
// [ObExprCast_ser_len, [ObExprOperator_ser_len, ObExprOperator_ser_data], is_implicit_cast_]
// 导致与老版本不兼容。
// 为了与各个版本兼容这里做了版本判断,如果最小版本为2273,那么使用与2273兼容的序列化逻辑,
// 否则仍使用ObExprOperator的序列化逻辑
if (CLUSTER_VERSION_2273 == GET_MIN_CLUSTER_VERSION()) {
BASE_SER((ObExprCast, ObFuncExprOperator));
OB_UNIS_ENCODE(is_implicit_cast);
} else {
ret = ObExprOperator::serialize_(buf, buf_len, pos);
}
ret = ObExprOperator::serialize_(buf, buf_len, pos);
return ret;
}
OB_DEF_DESERIALIZE(ObExprCast)
{
int ret = OB_SUCCESS;
if (CLUSTER_VERSION_2273 == GET_MIN_CLUSTER_VERSION()) {
bool is_implicit_cast = false;
BASE_DESER((ObExprCast, ObFuncExprOperator));
OB_UNIS_DECODE(is_implicit_cast);
extra_serialize_ = is_implicit_cast ? 1 : 0;
} else {
ret = ObExprOperator::deserialize_(buf, data_len, pos);
}
ret = ObExprOperator::deserialize_(buf, data_len, pos);
return ret;
}
OB_DEF_SERIALIZE_SIZE(ObExprCast)
{
int64_t len = 0;
if (CLUSTER_VERSION_2273 == GET_MIN_CLUSTER_VERSION()) {
bool is_implicit_cast = false;
BASE_ADD_LEN((ObExprCast, ObFuncExprOperator));
OB_UNIS_ADD_LEN(is_implicit_cast);
} else {
len = ObExprOperator::get_serialize_size_();
}
len = ObExprOperator::get_serialize_size_();
return len;
}

View File

@ -136,13 +136,9 @@ int ObExprColumnConv::convert_with_null_check(ObObj &result,
if (OB_FAIL(ObExprColumnConv::convert_skip_null_check(result, obj, res_type, is_strict,
cast_ctx, type_infos))) {
LOG_WARN("fail to convert skip null check", K(ret));
} else {
// if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2220) {
if (is_not_null && (result.is_null() || (lib::is_oracle_mode() && result.is_null_oracle()))) {
ret = OB_BAD_NULL_ERROR;
LOG_WARN("Column should not be null", K(ret));
// }
}
} else if (is_not_null && (result.is_null() || (lib::is_oracle_mode() && result.is_null_oracle()))) {
ret = OB_BAD_NULL_ERROR;
LOG_WARN("Column should not be null", K(ret));
}
return ret;
}

View File

@ -48,16 +48,7 @@ ObSqlExpression::~ObSqlExpression()
int ObSqlExpression::set_item_count(int64_t count)
{
int ret = OB_SUCCESS;
if (ObSqlExpressionUtil::should_gen_postfix_expr()) {
if (OB_FAIL(post_expr_.set_item_count(count))) {
LOG_WARN("failed to set item count", K(ret));
} else {
// do nothing
}
}
if (OB_FAIL(ret)) {
// do nothing
} else if (OB_FAIL(infix_expr_.set_item_count(count))) {
if (OB_FAIL(infix_expr_.set_item_count(count))) {
LOG_WARN("set expr item count failed", K(ret));
}
return ret;
@ -166,13 +157,6 @@ int ObSqlExpression::calc(ObExprCtx &expr_ctx, const common::ObNewRow &row1,
int ObSqlExpression::generate_idx_for_regexp_ops(int16_t &cur_regexp_op_count)
{
int ret = OB_SUCCESS;
if (ObSqlExpressionUtil::should_gen_postfix_expr()) {
if (OB_FAIL(post_expr_.generate_idx_for_regexp_ops(cur_regexp_op_count))) {
LOG_WARN("generate idx for regexp failed", K(ret));
} else {
// do nothing
}
}
if (OB_FAIL(infix_expr_.generate_idx_for_regexp_ops(cur_regexp_op_count))) {
LOG_WARN("generate idx for regexp failed", K(ret));
}
@ -610,15 +594,5 @@ int ObSqlExpressionUtil::expand_array_params(ObExprCtx &expr_ctx,
return ret;
}
bool ObSqlExpressionUtil::should_gen_postfix_expr()
{
bool bool_ret = false;
if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2230) {
bool_ret = true;
} else {
bool_ret = false;
}
return bool_ret;
}
} // namespace sql
} // namespace oceanbase

View File

@ -399,7 +399,6 @@ public:
static int expand_array_params(common::ObExprCtx &expr_ctx,
const common::ObObj &src_param,
const common::ObObj *&result);
static bool should_gen_postfix_expr();
private:
DISALLOW_COPY_AND_ASSIGN(ObSqlExpressionUtil);
ObSqlExpressionUtil();

View File

@ -193,16 +193,7 @@ DEFINE_DESERIALIZE(ObDesExecContext)
if (OB_SUCC(ret) && !OB_ISNULL(my_session_) && !OB_ISNULL(GCTX.sql_engine_)) {
ObPCMemPctConf pc_mem_conf;
if (OB_FAIL(my_session_->get_pc_mem_conf(pc_mem_conf))) {
if (OB_ENTRY_NOT_EXIST == ret && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2100) {
/**
* ignore OB_ENTRY_NOT_EXIST if in upgrade process, this session must come from
* 1470 or 2000, they can not generate remote / distributed plan with foreign
* key operation.
*/
ret = OB_SUCCESS;
} else {
LOG_WARN("failed to get pc mem conf", K(ret));
}
LOG_WARN("failed to get pc mem conf", K(ret));
} else {
my_session_->set_plan_cache_manager(GCTX.sql_engine_->get_plan_cache_manager());
}

View File

@ -730,8 +730,7 @@ int ObExecContext::init_physical_plan_ctx(const ObPhysicalPlan &plan)
}
}
if (OB_SUCC(ret)) {
if (!plan.is_remote_plan() || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2250) {
//从2250版本后,remote sql会发送到远端执行,本地不会再touch数据,因此不需要去分配参数空间
if (!plan.is_remote_plan()) {
if (OB_FAIL(phy_plan_ctx_->reserve_param_space(plan.get_param_count()))) {
LOG_WARN("reserve param space failed", K(ret), K(plan.get_param_count()));
}

View File

@ -606,13 +606,7 @@ inline int32_t *ObPhysicalPlan::alloc_projector(int64_t projector_size)
inline ObPhyPlanType ObPhysicalPlan::get_location_type() const
{
ObPhyPlanType location_type = location_type_;
if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2000 && OB_PHY_PLAN_UNINITIALIZED == location_type) {
//在集群升级过程中,不是所有Server都升级到2.0版本,有可能是1.4x老版本发送的计划,只有plan type,而没有location type,
//这个时候location type和plan type相等
location_type = plan_type_;
}
return location_type;
return location_type_;
}
} //namespace sql

View File

@ -335,8 +335,8 @@ int ObHashSetOp::init_hash_partition_infras()
&ctx_))) {
LOG_WARN("failed to init sql mem processor", K(ret));
} else if (OB_FAIL(hp_infras_.init(ctx_.get_my_session()->get_effective_tenant_id(),
GCONF.is_sql_operator_dump_enabled() && !(GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2250),
true, true, 2, &sql_mem_processor_))) {
GCONF.is_sql_operator_dump_enabled(),
true, true, 2, &sql_mem_processor_))) {
LOG_WARN("failed to init hash partition infrastructure", K(ret));
} else {
const ObHashSetSpec &spec = static_cast<const ObHashSetSpec&>(get_spec());

View File

@ -59,9 +59,7 @@ public:
ObSortColumnExtra(),
extra_info_(0)
{
if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2240) {
extra_info_ |= SORT_COL_EXTRA_BIT;
}
extra_info_ |= SORT_COL_EXTRA_BIT;
}
ObSortColumn(int64_t index,
common::ObCollationType cs_type,
@ -75,11 +73,7 @@ public:
} else {
extra_info_ &= SORT_COL_ASC_MASK;
}
if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2240) {
extra_info_ |= SORT_COL_EXTRA_BIT;
} else {
extra_info_ &= SORT_COL_EXTRA_MASK;
}
extra_info_ |= SORT_COL_EXTRA_BIT;
}
ObSortColumn(int64_t index,
common::ObCollationType cs_type,
@ -95,9 +89,7 @@ public:
extra_info_ |= SORT_COL_ASC_BIT;
}
extra_info_ &= SORT_COL_EXTRA_MASK;
if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2240) {
extra_info_ |= SORT_COL_EXTRA_BIT;
}
extra_info_ |= SORT_COL_EXTRA_BIT;
}
bool is_ascending() const {
return (extra_info_ & SORT_COL_ASC_BIT) > 0;