[FEAT MERGE]优化器技改patch到432

Co-authored-by: jingtaoye35 <1255153887@qq.com>
Co-authored-by: qingzhu521 <q15000557748@gmail.com>
Co-authored-by: akaError <lzg020616@163.com>
This commit is contained in:
zzg19950727
2024-06-18 02:23:55 +00:00
committed by ob-robot
parent 4d5b5ec653
commit b81b1efd98
117 changed files with 6600 additions and 948 deletions

View File

@ -3385,6 +3385,23 @@ int ObSql::generate_plan(ParseResult &parse_result,
OPT_TRACE_TITLE("CURRENT SQL TEXT");
OPT_TRACE("sql_id =", ObString(strlen(sql_ctx.sql_id_), sql_ctx.sql_id_));
OPT_TRACE(ObString(parse_result.input_sql_len_, parse_result.input_sql_));
// hint seed injected random status rand
const ObQueryHint &query_hint = stmt->get_query_ctx()->get_query_hint();
if (query_hint.has_outline_data() || session_info->is_inner()){
// if there is outline data no error inject
} else {
int64_t tmp_ret = (OB_E(EventTable::EN_GENERATE_RANDOM_PLAN) OB_SUCCESS);
if (OB_SUCCESS == tmp_ret) {
// do nothing
} else {
time_t seed = OB_ERROR == tmp_ret ? time(NULL) : std::abs(tmp_ret);
stmt->get_query_ctx()->set_injected_random_status(true);
stmt->get_query_ctx()->set_random_plan_seed(seed);
LOG_TRACE("The random seed for plan gen is ", K(seed));
}
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(transform_stmt(&stmt->get_query_ctx()->sql_schema_guard_,
opt_stat_mgr_,