[CP] fix: add status checks for resolver to handle timeout
This commit is contained in:
parent
1053c58354
commit
78c4792e72
@ -3095,7 +3095,15 @@ int ObDMLResolver::resolve_qualified_identifier(ObQualifiedName &q_name,
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_external = false;
|
||||
if (OB_ISNULL(stmt_) || OB_ISNULL(stmt_->get_query_ctx())) {
|
||||
ObExecContext *exec_ctx = NULL;
|
||||
if (OB_ISNULL(session_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected null session_info or exec context", K(ret), K(session_info_));
|
||||
} else {
|
||||
exec_ctx = session_info_->get_cur_exec_ctx();
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_ISNULL(stmt_) || OB_ISNULL(stmt_->get_query_ctx())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(ret), KP(stmt_));
|
||||
} else if (q_name.is_sys_func()) {
|
||||
@ -3285,7 +3293,9 @@ int ObDMLResolver::resolve_qualified_identifier(ObQualifiedName &q_name,
|
||||
//因为obj access的参数拉平处理,a(b,c)在columns会被存储为b,c,a,所以解释完一个ObQualifiedName,
|
||||
//都要把他前面的ObQualifiedName拿过来尝试替换一遍参数
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < real_exprs.count(); ++i) {
|
||||
if (OB_FAIL(ObRawExprUtils::replace_ref_column(real_ref_expr, columns.at(i).ref_expr_, real_exprs.at(i)))) {
|
||||
if ((0 == i % 1000) && NULL != exec_ctx && OB_FAIL(exec_ctx->check_status())) {
|
||||
LOG_WARN("check status failed", K(ret));
|
||||
} else if (OB_FAIL(ObRawExprUtils::replace_ref_column(real_ref_expr, columns.at(i).ref_expr_, real_exprs.at(i)))) {
|
||||
LOG_WARN("replace column ref expr failed", K(ret));
|
||||
}
|
||||
}
|
||||
@ -3303,7 +3313,11 @@ int ObDMLResolver::resolve_qualified_identifier(ObQualifiedName &q_name,
|
||||
}
|
||||
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < columns.count(); ++i) {
|
||||
OZ (columns.at(i).replace_access_ident_params(q_name.ref_expr_, real_ref_expr));
|
||||
if ((0 == i % 1000) && NULL != exec_ctx && OB_FAIL(exec_ctx->check_status())) {
|
||||
LOG_WARN("check status failed", K(ret));
|
||||
} else {
|
||||
OZ (columns.at(i).replace_access_ident_params(q_name.ref_expr_, real_ref_expr));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_ERR_BAD_FIELD_ERROR == ret) {
|
||||
|
@ -2024,12 +2024,15 @@ int ObSelectResolver::resolve_field_list(const ParseNode &node)
|
||||
bool is_bald_star = false;
|
||||
ObSelectStmt *select_stmt = NULL;
|
||||
bool enable_modify_null_name = false;
|
||||
ObExecContext *exec_ctx = NULL;
|
||||
//LOG_INFO("resolve_select_1", "usec", ObSQLUtils::get_usec());
|
||||
current_scope_ = T_FIELD_LIST_SCOPE;
|
||||
if (OB_ISNULL(session_info_) || OB_ISNULL(select_stmt = get_select_stmt())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(session_info_),
|
||||
K(select_stmt), K(ret));
|
||||
} else {
|
||||
exec_ctx = session_info_->get_cur_exec_ctx();
|
||||
}
|
||||
for (int32_t i = 0; OB_SUCC(ret) && i < node.num_child_; ++i) {
|
||||
alias_node = NULL;
|
||||
@ -2470,6 +2473,11 @@ int ObSelectResolver::resolve_field_list(const ParseNode &node)
|
||||
} else if (OB_FAIL(recursive_check_grouping_columns(select_stmt, select_item.expr_, false))) {
|
||||
LOG_WARN("failed to recursive check grouping columns", K(ret));
|
||||
} else {/*do nothing*/}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if ((0 == i % 1000) && NULL != exec_ctx && OB_FAIL(exec_ctx->check_status())) {
|
||||
LOG_WARN("check status failed", K(ret));
|
||||
}
|
||||
} // end for
|
||||
|
||||
if (OB_SUCC(ret) && OB_FAIL(transfer_rb_iterate_items())) {
|
||||
@ -3921,33 +3929,41 @@ int ObSelectResolver::resolve_from_clause(const ParseNode *node)
|
||||
current_scope_ = T_FROM_SCOPE;
|
||||
ObSelectStmt *select_stmt = NULL;
|
||||
TableItem *table_item = NULL;
|
||||
ObExecContext *exec_ctx = NULL;
|
||||
CK( OB_NOT_NULL(select_stmt = get_select_stmt()),
|
||||
node->type_ == T_FROM_LIST,
|
||||
node->num_child_ >= 1);
|
||||
if (OB_SUCC(ret)) {
|
||||
exec_ctx = session_info_->get_cur_exec_ctx();
|
||||
}
|
||||
for (int32_t i = 0; OB_SUCC(ret) && i < node->num_child_; i += 1) {
|
||||
ParseNode *table_node = node->children_[i];
|
||||
CK(OB_NOT_NULL(table_node));
|
||||
const bool old_flag = session_info_->is_table_name_hidden();
|
||||
bool is_table_hidden = false;
|
||||
const ObSessionDDLInfo &ddl_info = session_info_->get_ddl_info();
|
||||
// add foreign key will use select xx from t1 minus select xx from t2, here t1 is source table, t2 is dest table
|
||||
if (ddl_info.is_ddl()) {
|
||||
if (in_set_query_) {
|
||||
is_table_hidden = is_left_child_ ? ddl_info.is_source_table_hidden() : ddl_info.is_dest_table_hidden();
|
||||
} else {
|
||||
is_table_hidden = ddl_info.is_source_table_hidden();
|
||||
if ((0 == i % 1000) && NULL != exec_ctx && OB_FAIL(exec_ctx->check_status())) {
|
||||
LOG_WARN("check status failed", K(ret));
|
||||
} else {
|
||||
ParseNode *table_node = node->children_[i];
|
||||
CK(OB_NOT_NULL(table_node));
|
||||
const bool old_flag = session_info_->is_table_name_hidden();
|
||||
bool is_table_hidden = false;
|
||||
const ObSessionDDLInfo &ddl_info = session_info_->get_ddl_info();
|
||||
// add foreign key will use select xx from t1 minus select xx from t2, here t1 is source table, t2 is dest table
|
||||
if (ddl_info.is_ddl()) {
|
||||
if (in_set_query_) {
|
||||
is_table_hidden = is_left_child_ ? ddl_info.is_source_table_hidden() : ddl_info.is_dest_table_hidden();
|
||||
} else {
|
||||
is_table_hidden = ddl_info.is_source_table_hidden();
|
||||
}
|
||||
}
|
||||
// TODO@wenqu: wait flags from session info
|
||||
session_info_->set_table_name_hidden(is_table_hidden);
|
||||
OZ( resolve_table(*table_node, table_item) );
|
||||
session_info_->set_table_name_hidden(old_flag);
|
||||
OZ( column_namespace_checker_.add_reference_table(table_item), table_item );
|
||||
OZ( select_stmt->add_from_item(table_item->table_id_, table_item->is_joined_table()) );
|
||||
// oracle outer join will change from items
|
||||
OZ( add_from_items_order(table_item), table_item );
|
||||
if (OB_SUCC(ret)) {
|
||||
select_stmt->set_has_reverse_link(table_item->is_reverse_link_);
|
||||
}
|
||||
}
|
||||
// TODO@wenqu: wait flags from session info
|
||||
session_info_->set_table_name_hidden(is_table_hidden);
|
||||
OZ( resolve_table(*table_node, table_item) );
|
||||
session_info_->set_table_name_hidden(old_flag);
|
||||
OZ( column_namespace_checker_.add_reference_table(table_item), table_item );
|
||||
OZ( select_stmt->add_from_item(table_item->table_id_, table_item->is_joined_table()) );
|
||||
// oracle outer join will change from items
|
||||
OZ( add_from_items_order(table_item), table_item );
|
||||
if (OB_SUCC(ret)) {
|
||||
select_stmt->set_has_reverse_link(table_item->is_reverse_link_);
|
||||
}
|
||||
}
|
||||
OZ( gen_unpivot_target_column(node->num_child_, *select_stmt, *table_item) );
|
||||
|
@ -837,15 +837,20 @@ int ObSelectStmt::get_same_win_func_item(const ObRawExpr *expr, ObWinFunRawExpr
|
||||
LOG_WARN("unexpected null", K(ret));
|
||||
} else {
|
||||
ObQuestionmarkEqualCtx cmp_ctx;
|
||||
for (int64_t i = 0; i < win_func_exprs_.count(); ++i) {
|
||||
bool is_existed = false;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && !is_existed && i < win_func_exprs_.count(); ++i) {
|
||||
bool need_check_status = (i + 1) % 1000 == 0;
|
||||
if (win_func_exprs_.at(i) != NULL && expr != NULL &&
|
||||
expr->same_as(*win_func_exprs_.at(i), &cmp_ctx)) {
|
||||
win_expr = win_func_exprs_.at(i);
|
||||
break;
|
||||
is_existed = true;
|
||||
} else if (need_check_status &&
|
||||
OB_FAIL(THIS_WORKER.check_status())) {
|
||||
LOG_WARN("failed to check status", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(append(query_ctx_->all_equal_param_constraints_,
|
||||
cmp_ctx.equal_pairs_))) {
|
||||
if (OB_SUCC(ret) && OB_FAIL(append(query_ctx_->all_equal_param_constraints_,
|
||||
cmp_ctx.equal_pairs_))) {
|
||||
LOG_WARN("failed to append equal param info", K(ret));
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,10 @@ private:
|
||||
}
|
||||
inline bool is_blacklist_share_child(const ObRawExpr &expr)
|
||||
{
|
||||
return expr.is_aggr_expr() || expr.is_win_func_expr() || T_OP_CASE == expr.get_expr_type();
|
||||
return expr.is_aggr_expr()
|
||||
|| expr.is_win_func_expr()
|
||||
|| T_OP_CASE == expr.get_expr_type()
|
||||
|| T_OP_ROW == expr.get_expr_type();
|
||||
}
|
||||
inline bool is_blacklist_share_const(const ObRawExpr &expr)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user