[CP] to issue<53546058>:trigger always forbid pdml

This commit is contained in:
obdev
2024-02-09 02:01:08 +00:00
committed by ob-robot
parent 26979a9778
commit 3e257b3896
4 changed files with 19 additions and 18 deletions

View File

@ -426,7 +426,7 @@ int ObOptimizer::check_pdml_supported_feature(const ObDelUpdStmt &pdml_stmt,
ctx_.add_plan_note(PDML_DISABLED_BY_INSERT_UP);
} else if (ctx_.has_dblink()) {
is_use_pdml = false;
} else if (!ctx_.has_trigger() && ctx_.contain_user_nested_sql()) {
} else if (ctx_.contain_user_nested_sql()) {
//user nested sql can't use PDML plan, force to use DAS plan
//if online ddl has pl udf, only this way, allow it use PDML plan
//such as:
@ -435,11 +435,6 @@ int ObOptimizer::check_pdml_supported_feature(const ObDelUpdStmt &pdml_stmt,
//create index with PL UDF allow to use PDML plan during build index table
is_use_pdml = false;
ctx_.add_plan_note(PDML_DISABLED_BY_NESTED_SQL);
} else if (!ctx_.is_online_ddl() && ctx_.has_trigger() && !ctx_.is_allow_parallel_trigger()) {
// if sql linked trigger, and trigger do not access package var, sequence, sql stmt etc..,
// allow it use PDML plan
is_use_pdml = false;
ctx_.add_plan_note(PDML_DISABLED_BY_NESTED_SQL);
} else if (stmt::T_DELETE == pdml_stmt.get_stmt_type()) {
//
// if no trigger, no foreign key, delete can do pdml, even if with local unique index
@ -745,7 +740,6 @@ int ObOptimizer::check_whether_contain_nested_sql(const ObDMLStmt &stmt)
const ObTableSchema *table_schema = nullptr;
ObSQLSessionInfo *session = ctx_.get_session_info();
bool trigger_exists = false;
bool is_forbid_parallel = false;
if (OB_ISNULL(table_info) || OB_ISNULL(schema_guard) || OB_ISNULL(session)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("sql schema guard is nullptr", K(ret), K(table_info), K(schema_guard), K(session));
@ -764,13 +758,6 @@ int ObOptimizer::check_whether_contain_nested_sql(const ObDMLStmt &stmt)
ctx_.set_has_trigger(true);
}
}
if (OB_SUCC(ret) && trigger_exists) {
if (OB_FAIL(table_schema->is_allow_parallel_of_trigger(*schema_guard, is_forbid_parallel))) {
LOG_WARN("check allow parallel failed", K(ret));
} else if (!is_forbid_parallel) {
ctx_.set_allow_parallel_trigger(true);
}
}
}
}
return ret;

View File

@ -573,8 +573,6 @@ ObOptimizerContext(ObSQLSessionInfo *session_info,
bool has_trigger() const { return has_trigger_; }
void set_has_pl_udf(bool v) { has_pl_udf_ = v; }
bool has_pl_udf() const { return has_pl_udf_; }
void set_allow_parallel_trigger(bool v) { is_allow_parallel_trigger_ = v; }
bool is_allow_parallel_trigger() const { return is_allow_parallel_trigger_; }
void set_has_cursor_expression(bool v) { has_cursor_expression_ = v; }
bool has_cursor_expression() const { return has_cursor_expression_; }
void set_has_dblink(bool v) { has_dblink_ = v; }
@ -671,7 +669,6 @@ private:
int8_t has_pl_udf_ : 1; //this sql has pl user defined function
int8_t has_subquery_in_function_table_ : 1; //this stmt has function table
int8_t has_dblink_ : 1; //this stmt has dblink table
int8_t is_allow_parallel_trigger_ : 1; //this sql linked trigger can parallel execute
int8_t has_cursor_expression_ : 1; //this sql has cursor expression
};
};