[CP] Fix: fix the bug induced by tracepoint to generate NLJ path

This commit is contained in:
obdev 2024-04-30 08:23:10 +00:00 committed by ob-robot
parent 084bf7584f
commit b119e2ccda

View File

@ -11835,9 +11835,10 @@ int ObJoinOrder::get_valid_path_info(const ObJoinOrder &left_tree,
if (OB_SUCC(ret)) {
bool force_use_nlj = false;
force_use_nlj = (OB_SUCCESS != (OB_E(EventTable::EN_GENERATE_PLAN_WITH_NLJ) OB_SUCCESS));
//if tracepoint is triggered and the local methiods contain NLJ, remove the merge-join paths to use nlj as possible
//if tracepoint is triggered and the local methiods contain NLJ, remove the merge-join and hash-join to use nlj as possible
if (force_use_nlj && (path_info.local_methods_ & NESTED_LOOP_JOIN)) {
path_info.local_methods_ &= ~MERGE_JOIN;
path_info.local_methods_ &= ~HASH_JOIN;
}
}
//check batch update join type
@ -12665,36 +12666,11 @@ int ObJoinOrder::create_and_add_nl_path(const Path *left_path,
} else if (OB_FAIL(create_subplan_filter_for_join_path(join_path,
subquery_filters))) {
LOG_WARN("failed to create subplan filter for join path", K(ret));
}
if (OB_SUCC(ret)) {
bool force_use_nlj = false;
// Trace point to force use NLJ as possible
force_use_nlj = (OB_SUCCESS != (OB_E(EventTable::EN_GENERATE_PLAN_WITH_NLJ) OB_SUCCESS));
if (force_use_nlj && !join_path->contain_normal_nl_) {
// If the tracepoint is triggered, the nlj path is forced to add into interesting_paths,
// and other paths of different join types are removed
LOG_TRACE("trigger trace point to generate nest-loop join paths");
if (join_path->join_algo_ != NESTED_LOOP_JOIN) {
LOG_WARN("generated join type is not NLJ", K(ret));
} else if (OB_FAIL(interesting_paths_.push_back(join_path))) {
LOG_WARN("failed to push back nlj path");
} else {
for (int64_t i = interesting_paths_.count() - 1; OB_SUCC(ret) && i >= 0; --i) {
JoinPath *join_path = reinterpret_cast<JoinPath *>(interesting_paths_.at(i));
if (join_path->join_algo_ != NESTED_LOOP_JOIN) {
if (OB_FAIL(interesting_paths_.remove(i))) {
LOG_WARN("failed to remove dominated plans", K(i), K(ret));
}
}
}
}
} else if (OB_FAIL(add_path(join_path))) {
LOG_WARN("failed to add path", K(ret));
} else {
LOG_TRACE("succeed to create a nested loop join path", K(join_type),
K(join_dist_algo), K(need_mat), K(on_conditions), K(where_conditions));
}
} else if (OB_FAIL(add_path(join_path))) {
LOG_WARN("failed to add path", K(ret));
} else {
LOG_TRACE("succeed to create a nested loop join path", K(join_type),
K(join_dist_algo), K(need_mat), K(on_conditions), K(where_conditions));
}
}
return ret;