Fix: fix the bug of get_root_ctx function;

This commit is contained in:
obdev
2022-11-17 08:38:07 +00:00
committed by wangzelin.wzl
parent 41c7ed5063
commit f9b661406a
2 changed files with 13 additions and 4 deletions

View File

@ -229,9 +229,7 @@ int ObExecContext::get_root_ctx(ObExecContext* &root_ctx)
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (OB_ISNULL(this->get_parent_ctx())) { if (OB_ISNULL(this->get_parent_ctx())) {
root_ctx = this; root_ctx = this;
} else if (OB_ISNULL(get_parent_ctx()->get_pl_stack_ctx())) { } else if (get_parent_ctx()->get_pl_stack_ctx() != nullptr && get_parent_ctx()->get_pl_stack_ctx()->in_autonomous()) {
root_ctx = this;
} else if (get_parent_ctx()->get_pl_stack_ctx()->in_autonomous()) {
root_ctx = this; root_ctx = this;
} else if (OB_FAIL( SMART_CALL(get_parent_ctx()->get_root_ctx(root_ctx)))) { } else if (OB_FAIL( SMART_CALL(get_parent_ctx()->get_root_ctx(root_ctx)))) {
LOG_WARN("failed to get root ctx", K(ret)); LOG_WARN("failed to get root ctx", K(ret));
@ -239,6 +237,17 @@ int ObExecContext::get_root_ctx(ObExecContext* &root_ctx)
return 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 ObExecContext::init_phy_op(const uint64_t phy_op_size)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;

View File

@ -209,7 +209,7 @@ public:
ObExecContext *get_parent_ctx() { return parent_ctx_; } ObExecContext *get_parent_ctx() { return parent_ctx_; }
//get the root execute context in nested sql //get the root execute context in nested sql
int get_root_ctx(ObExecContext* &root_ctx); int get_root_ctx(ObExecContext* &root_ctx);
bool is_root_ctx() {return parent_ctx_ == nullptr;} bool is_root_ctx();
int64_t get_nested_level() const { return nested_level_; } int64_t get_nested_level() const { return nested_level_; }
/** /**
* @brief set sql proxy * @brief set sql proxy