[scn] fix failure of mittest after refresh feature scn
This commit is contained in:
@ -272,7 +272,6 @@ int ObQueryHint::check_ddl_schema_version_from_hint(const ObDMLStmt &stmt,
|
||||
OB_UNLIKELY(ddlSchemaVersionHint.schema_version_ != item->ddl_schema_version_)) {
|
||||
ret = OB_DDL_SCHEMA_VERSION_NOT_MATCH;
|
||||
LOG_USER_ERROR(OB_DDL_SCHEMA_VERSION_NOT_MATCH);
|
||||
LOG_WARN("failed to check ddl schema version", K(ret), K(item->ddl_schema_version_), K(ddlSchemaVersionHint.schema_version_));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -895,7 +894,7 @@ int ObQueryHint::get_qb_name(int64_t stmt_id, ObString &qb_name) const
|
||||
qb_name.reset();
|
||||
if (OB_UNLIKELY(stmt_id < 0 || stmt_id >= stmt_id_map_.count())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected stmt id", K(ret), K(stmt_id), K(stmt_id_map_.count()), K(stmt_id_map_));
|
||||
LOG_WARN("unexpected stmt id", K(ret), K(stmt_id), K(stmt_id_map_));
|
||||
} else {
|
||||
const ObIArray<ObString> &qb_names = stmt_id_map_.at(stmt_id).qb_names_;
|
||||
if (OB_UNLIKELY(qb_names.empty() || qb_names.at(qb_names.count() - 1).empty())) {
|
||||
@ -1089,26 +1088,40 @@ int ObStmtHint::init_stmt_hint(const ObDMLStmt &stmt,
|
||||
set_query_hint(&query_hint);
|
||||
ObString qb_name;
|
||||
const ObHints *qb_hints = NULL;
|
||||
ObSEArray<ObHint*, 16> all_hints;
|
||||
if (OB_FAIL(stmt.get_qb_name(qb_name))) {
|
||||
LOG_WARN("failed to get qb name", K(ret));
|
||||
} else if (NULL != (qb_hints = query_hint.get_qb_hints(qb_name))
|
||||
&& OB_FAIL(all_hints.assign(qb_hints->hints_))) {
|
||||
LOG_WARN("failed to assign hints", K(ret));
|
||||
} else if (use_stmt_id_hints
|
||||
&& NULL != (qb_hints = query_hint.get_stmt_id_hints(stmt.get_stmt_id()))
|
||||
&& OB_FAIL(append(all_hints, qb_hints->hints_))) {
|
||||
LOG_WARN("failed to append hints", K(ret));
|
||||
const ObHints *stmt_id_hints = use_stmt_id_hints
|
||||
? query_hint.get_stmt_id_hints(stmt.get_stmt_id())
|
||||
: NULL;
|
||||
if (OB_FAIL(query_hint.get_qb_name(stmt.get_stmt_id(), qb_name))) {
|
||||
LOG_WARN("failed to get qb name", K(ret), K(stmt.get_stmt_id()), K(qb_name));
|
||||
} else if (OB_FALSE_IT(qb_hints = query_hint.get_qb_hints(qb_name))) {
|
||||
} else if (NULL == qb_hints && NULL == stmt_id_hints) {
|
||||
/* do nothing */
|
||||
} else {
|
||||
const int64_t M = NULL == qb_hints ? 0 : qb_hints->hints_.count();
|
||||
const int64_t N = NULL == stmt_id_hints ? M : M + stmt_id_hints->hints_.count();
|
||||
ObHint *hint = NULL;
|
||||
bool may_used = false;
|
||||
ObSEArray<ObTableInHint*, 8> all_tables;
|
||||
ObSEArray<ObItemType, 4> conflict_hints;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < all_hints.count(); ++i) {
|
||||
if (OB_ISNULL(all_hints.at(i))) {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < N; ++i) {
|
||||
hint = i < M ? qb_hints->hints_.at(i) : stmt_id_hints->hints_.at(i - M);
|
||||
may_used = false;
|
||||
all_tables.reuse();
|
||||
if (OB_ISNULL(hint)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected null", K(ret), K(i), K(all_hints));
|
||||
} else if (OB_FAIL(merge_hint(*all_hints.at(i), HINT_DOMINATED_EQUAL, conflict_hints))) {
|
||||
LOG_WARN("unexpected null", K(ret), K(hint));
|
||||
} else if (OB_FAIL(hint->get_all_table_in_hint(all_tables))) {
|
||||
LOG_WARN("failed to get all in hint", K(ret));
|
||||
} else if (OB_FAIL(stmt.hint_table_may_used(query_hint.cs_type_, all_tables, may_used))) {
|
||||
LOG_WARN("failed to check is hint table may used", K(ret));
|
||||
} else if (!may_used) {
|
||||
/* do nothing */
|
||||
} else if (OB_FAIL(merge_hint(*hint, HINT_DOMINATED_EQUAL, conflict_hints))) {
|
||||
LOG_WARN("failed to merge hint", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
LOG_DEBUG("finish init stmt hint", K(stmt.get_stmt_id()), K(qb_name), K(*this));
|
||||
}
|
||||
return ret;
|
||||
@ -1442,28 +1455,17 @@ int ObStmtHint::reset_explicit_trans_hint(ObItemType hint_type)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStmtHint::get_max_table_parallel(const ObDMLStmt &stmt, int64_t &max_table_parallel) const
|
||||
int64_t ObStmtHint::get_max_table_parallel() const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
max_table_parallel = ObGlobalHint::UNSET_PARALLEL;
|
||||
int64_t max_table_parallel = ObGlobalHint::UNSET_PARALLEL;
|
||||
const ObHint *hint = NULL;
|
||||
bool matched = false;
|
||||
if (OB_ISNULL(query_hint_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected null", K(ret), K(query_hint_));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < other_opt_hints_.count(); ++i) {
|
||||
for (int64_t i = 0; i < other_opt_hints_.count(); ++i) {
|
||||
if (OB_NOT_NULL(hint = other_opt_hints_.at(i)) && hint->is_table_parallel_hint()) {
|
||||
if (OB_FAIL(stmt.check_hint_table_matched_table_item(query_hint_->cs_type_,
|
||||
static_cast<const ObTableParallelHint*>(hint)->get_table(), matched))) {
|
||||
LOG_WARN("failed to check hint table matched table item", K(ret));
|
||||
} else if (matched) {
|
||||
max_table_parallel = std::max(max_table_parallel,
|
||||
max_table_parallel = std::max(max_table_parallel,
|
||||
static_cast<const ObTableParallelHint*>(hint)->get_parallel());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return max_table_parallel;
|
||||
}
|
||||
|
||||
bool ObStmtHint::has_enable_hint(ObItemType hint_type) const
|
||||
@ -1602,10 +1604,6 @@ int ObLogPlanHint::add_index_hint(const ObDMLStmt &stmt,
|
||||
LOG_WARN("failed to get log table hint by hint", K(ret));
|
||||
} else if (NULL == log_table_hint) {
|
||||
/* do nothing */
|
||||
} else if (T_USE_DAS_HINT == index_hint.get_hint_type()) {
|
||||
if (NULL == log_table_hint->use_das_hint_ || index_hint.is_enable_hint()) {
|
||||
log_table_hint->use_das_hint_ = &index_hint;
|
||||
}
|
||||
} else if (OB_FAIL(log_table_hint->index_hints_.push_back(&index_hint))) {
|
||||
LOG_WARN("failed to push back", K(ret));
|
||||
}
|
||||
@ -1781,22 +1779,6 @@ const ObTableParallelHint *ObLogPlanHint::get_parallel_hint(uint64_t table_id) c
|
||||
return NULL == log_table_hint ? NULL : log_table_hint->parallel_hint_;
|
||||
}
|
||||
|
||||
int ObLogPlanHint::check_use_das(uint64_t table_id, bool &force_das, bool &force_no_das) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
force_das = false;
|
||||
force_no_das = false;
|
||||
const LogTableHint *log_table_hint = get_log_table_hint(table_id);
|
||||
const ObHint *hint = NULL == log_table_hint ? NULL : log_table_hint->use_das_hint_;
|
||||
if (NULL != hint) {
|
||||
force_das = hint->is_enable_hint();
|
||||
force_no_das = hint->is_disable_hint();
|
||||
} else if (is_outline_data_) {
|
||||
force_no_das = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogPlanHint::check_use_join_filter(uint64_t filter_table_id,
|
||||
const ObRelIds &left_tables,
|
||||
bool part_join_filter,
|
||||
@ -1865,45 +1847,6 @@ DistAlgo ObLogPlanHint::get_valid_set_dist_algo(int64_t *random_none_idx /* defa
|
||||
return set_dist_algo;
|
||||
}
|
||||
|
||||
int ObLogPlanHint::check_valid_set_left_branch(const ObSelectStmt *select_stmt,
|
||||
bool &hint_valid,
|
||||
bool &need_swap) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
hint_valid = false;
|
||||
need_swap = false;
|
||||
const ObPQSetHint *pq_set_hint = NULL;
|
||||
ObString left_child;
|
||||
ObString right_child;
|
||||
if (OB_UNLIKELY(!select_stmt->is_set_stmt()
|
||||
|| !select_stmt->is_set_distinct()
|
||||
|| 2 > select_stmt->get_set_query().count())
|
||||
|| OB_ISNULL(select_stmt->get_set_query(0))
|
||||
|| OB_ISNULL(select_stmt->get_set_query(1))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected set_op stmt", K(ret), K(select_stmt));
|
||||
} else if (NULL == (pq_set_hint = static_cast<const ObPQSetHint*>(get_normal_hint(T_PQ_SET)))) {
|
||||
hint_valid = is_outline_data_;
|
||||
need_swap = false;
|
||||
} else if (pq_set_hint->get_left_branch().empty()) {
|
||||
hint_valid = true;
|
||||
need_swap = false;
|
||||
} else if (OB_FAIL(select_stmt->get_set_query(0)->get_qb_name(left_child))
|
||||
|| OB_FAIL(select_stmt->get_set_query(1)->get_qb_name(right_child))) {
|
||||
LOG_WARN("failed to get qb name", K(ret));
|
||||
} else if (0 == pq_set_hint->get_left_branch().case_compare(left_child)) {
|
||||
hint_valid = true;
|
||||
need_swap = false;
|
||||
} else if (0 == pq_set_hint->get_left_branch().case_compare(right_child)) {
|
||||
hint_valid = true;
|
||||
need_swap = true;
|
||||
} else {
|
||||
hint_valid = false;
|
||||
need_swap = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// generate spm evolution plan, throw a error code when can not get valid hint
|
||||
int ObLogPlanHint::check_status() const
|
||||
{
|
||||
@ -2185,7 +2128,6 @@ int LogTableHint::assign(const LogTableHint &other)
|
||||
table_ = other.table_;
|
||||
index_type_ = other.index_type_;
|
||||
parallel_hint_ = other.parallel_hint_;
|
||||
use_das_hint_ = other.use_das_hint_;
|
||||
if (OB_FAIL(index_list_.assign(other.index_list_))) {
|
||||
LOG_WARN("failed to assign index list", K(ret));
|
||||
} else if (OB_FAIL(index_hints_.assign(other.index_hints_))) {
|
||||
|
||||
Reference in New Issue
Block a user