[SCN] fix farm failure

This commit is contained in:
obdev
2022-11-28 02:58:33 +00:00
committed by ob-robot
parent 87a9357186
commit 51de5b5911
594 changed files with 9722 additions and 7770 deletions

View File

@ -112,6 +112,7 @@ ObExecContext::ObExecContext(ObIAllocator &allocator)
px_batch_id_(0),
admission_version_(UINT64_MAX),
admission_addr_map_(),
use_temp_expr_ctx_cache_(false),
temp_expr_ctx_map_(),
dml_event_(ObDmlEventType::DE_INVALID),
update_columns_(nullptr),
@ -196,7 +197,7 @@ void ObExecContext::clean_resolve_ctx()
uint64_t ObExecContext::get_ser_version() const
{
return GET_UNIS_CLUSTER_VERSION() < CLUSTER_VERSION_2250 ? SER_VERSION_0 : SER_VERSION_1;
return SER_VERSION_1;
}
void ObExecContext::reset_op_ctx()
@ -223,6 +224,30 @@ void ObExecContext::reset_op_env()
}
}
int ObExecContext::get_root_ctx(ObExecContext* &root_ctx)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(this->get_parent_ctx())) {
root_ctx = this;
} else if (get_parent_ctx()->get_pl_stack_ctx() != nullptr && get_parent_ctx()->get_pl_stack_ctx()->in_autonomous()) {
root_ctx = this;
} else if (OB_FAIL( SMART_CALL(get_parent_ctx()->get_root_ctx(root_ctx)))) {
LOG_WARN("failed to get root ctx", K(ret));
}
return ret;
}
bool ObExecContext::is_root_ctx()
{
bool ret = false;
if (OB_ISNULL(this->get_parent_ctx())) {
ret = true;
} else if (get_parent_ctx()->get_pl_stack_ctx() != nullptr && get_parent_ctx()->get_pl_stack_ctx()->in_autonomous()) {
ret = true;
}
return ret;
}
int ObExecContext::init_phy_op(const uint64_t phy_op_size)
{
int ret = OB_SUCCESS;
@ -301,25 +326,29 @@ int ObExecContext::get_temp_expr_eval_ctx(const ObTempExpr &temp_expr,
ObTempExprCtx *&temp_expr_ctx)
{
int ret = OB_SUCCESS;
if (!temp_expr_ctx_map_.created()) {
OZ(temp_expr_ctx_map_.create(8, ObLabel("TempExprCtx")));
}
if (OB_SUCC(ret)) {
int64_t ctx_ptr = 0;
if (OB_FAIL(temp_expr_ctx_map_.get_refactored(reinterpret_cast<int64_t>(&temp_expr),
ctx_ptr))) {
if (OB_HASH_NOT_EXIST == ret) {
ret = OB_SUCCESS;
OZ(build_temp_expr_ctx(temp_expr, temp_expr_ctx));
CK(OB_NOT_NULL(temp_expr_ctx));
OZ(temp_expr_ctx_map_.set_refactored(reinterpret_cast<int64_t>(&temp_expr),
reinterpret_cast<int64_t>(temp_expr_ctx)));
} else {
LOG_WARN("fail to get temp expr ctx", K(temp_expr), K(ret));
}
} else {
temp_expr_ctx = reinterpret_cast<ObTempExprCtx *>(ctx_ptr);
if (use_temp_expr_ctx_cache_) {
if (!temp_expr_ctx_map_.created()) {
OZ(temp_expr_ctx_map_.create(8, ObLabel("TempExprCtx")));
}
if (OB_SUCC(ret)) {
int64_t ctx_ptr = 0;
if (OB_FAIL(temp_expr_ctx_map_.get_refactored(reinterpret_cast<int64_t>(&temp_expr),
ctx_ptr))) {
if (OB_HASH_NOT_EXIST == ret) {
ret = OB_SUCCESS;
OZ(build_temp_expr_ctx(temp_expr, temp_expr_ctx));
CK(OB_NOT_NULL(temp_expr_ctx));
OZ(temp_expr_ctx_map_.set_refactored(reinterpret_cast<int64_t>(&temp_expr),
reinterpret_cast<int64_t>(temp_expr_ctx)));
} else {
LOG_WARN("fail to get temp expr ctx", K(temp_expr), K(ret));
}
} else {
temp_expr_ctx = reinterpret_cast<ObTempExprCtx *>(ctx_ptr);
}
}
} else {
OZ(build_temp_expr_ctx(temp_expr, temp_expr_ctx));
}
return ret;
@ -710,8 +739,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()));
}