to issue<45173384>:fix cursor expression remote execute issue

This commit is contained in:
obdev
2023-05-06 06:48:40 +00:00
committed by ob-robot
parent 631fde402f
commit 05ffe5a646
5 changed files with 29 additions and 0 deletions

View File

@ -519,6 +519,7 @@ int ObOptimizer::extract_opt_ctx_basic_flags(const ObDMLStmt &stmt, ObSQLSession
bool has_subquery_in_function_table = false;
bool has_dblink = false;
bool force_serial_set_order = false;
bool has_cursor_expr = false;
int64_t link_stmt_count = 0;
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(session.get_effective_tenant_id()));
bool rowsets_enabled = tenant_config.is_valid() && tenant_config->_rowsets_enabled;
@ -539,6 +540,8 @@ int ObOptimizer::extract_opt_ctx_basic_flags(const ObDMLStmt &stmt, ObSQLSession
LOG_WARN("failed to find dblink in stmt", K(ret));
} else if (OB_FAIL(ctx_.get_global_hint().opt_params_.get_bool_opt_param(ObOptParamHint::ROWSETS_ENABLED, rowsets_enabled))) {
LOG_WARN("fail to check rowsets enabled", K(ret));
} else if (OB_FAIL(stmt.check_has_cursor_expression(has_cursor_expr))) {
LOG_WARN("fail to check cursor expression info", K(ret));
} else {
ctx_.set_serial_set_order(force_serial_set_order);
ctx_.set_has_multiple_link_stmt(link_stmt_count > 1);
@ -547,6 +550,7 @@ int ObOptimizer::extract_opt_ctx_basic_flags(const ObDMLStmt &stmt, ObSQLSession
ctx_.set_has_subquery_in_function_table(has_subquery_in_function_table);
ctx_.set_has_dblink(has_dblink);
ctx_.set_cost_model_type(rowsets_enabled ? ObOptEstCost::VECTOR_MODEL : ObOptEstCost::NORMAL_MODEL);
ctx_.set_has_cursor_expression(has_cursor_expr);
}
return ret;
}
@ -578,6 +582,9 @@ int ObOptimizer::init_parallel_policy(ObDMLStmt &stmt, const ObSQLSessionInfo &s
if (ctx_.has_pl_udf()) {
//following above rule, but if stmt contain pl_udf, force das, parallel should be 1
ctx_.set_parallel_rule(PXParallelRule::PL_UDF_DAS_FORCE_SERIALIZE);
} else if (ctx_.has_cursor_expression()) {
// if stmt contain cursor expression, cannot remote execute, force das, parallel should be 1
ctx_.set_parallel_rule(PXParallelRule::PL_UDF_DAS_FORCE_SERIALIZE);
} else if (ctx_.has_dblink()) {
//if stmt contain dblink, force das, parallel should be 1
ctx_.set_parallel_rule(PXParallelRule::DBLINK_FORCE_SERIALIZE);