Fixed the problem of <hint add material> causing the logic <hint add monitor dump> to change.

This commit is contained in:
obdev
2024-02-08 21:29:12 +00:00
committed by ob-robot
parent ef105cab85
commit 31b14bcba4

View File

@ -3153,40 +3153,25 @@ int ObLogicalOperator::alloc_op_post(AllocOpContext& ctx)
if (query_ctx->get_global_hint().alloc_op_hints_.empty()){ if (query_ctx->get_global_hint().alloc_op_hints_.empty()){
/*no ops will be allocated, skip*/ /*no ops will be allocated, skip*/
} else { } else {
ret = ctx.disabled_op_set_.exist_refactored(op_id_); const ObIArray<ObAllocOpHint> &alloc_op_hints = query_ctx->get_global_hint().alloc_op_hints_;
if (OB_HASH_EXIST == ret) { // There won't be too many 'blocking or tracing' hints, so it is acceptable for us to traverse the entire array three times:
/*skip*/ // Allocate `all` level nodes first
ret = OB_SUCCESS; // Allocate `dfo` level nodes srcond
} else if (OB_HASH_NOT_EXIST == ret){ // Allocate enumerate level nodes finally
ret = OB_SUCCESS; for (int64_t i = 0; OB_SUCC(ret) && i < alloc_op_hints.count(); ++i) {
const ObIArray<ObAllocOpHint> &alloc_op_hints = query_ctx->get_global_hint().alloc_op_hints_; if (ObAllocOpHint::OB_ALL == alloc_op_hints.at(i).alloc_level_ &&
// There won't be too many 'blocking or tracing' hints, so it is acceptable for us to traverse the entire array three times: OB_FAIL(alloc_nodes_above(ctx, alloc_op_hints.at(i).flags_))) {
// Allocate `all` level nodes first LOG_WARN("fail to alloc op at all level", K(ret));
// Allocate `dfo` level nodes srcond } else if (ObAllocOpHint::OB_DFO == alloc_op_hints.at(i).alloc_level_ &&
// Allocate enumerate level nodes finally (log_op_def::LOG_EXCHANGE == type_ &&
for (int64_t i = 0; OB_SUCC(ret) && i < alloc_op_hints.count(); ++i) { static_cast<ObLogExchange*>(this)->is_consumer()) &&
if (ObAllocOpHint::OB_ALL == alloc_op_hints.at(i).alloc_level_ && OB_FAIL(alloc_nodes_above(ctx, alloc_op_hints.at(i).flags_))) {
OB_FAIL(alloc_nodes_above(ctx, alloc_op_hints.at(i).flags_))) { LOG_WARN("fail to alloc op at dfo level", K(ret));
LOG_WARN("fail to alloc op at all level", K(ret)); } else if (ObAllocOpHint::OB_ENUMERATE == alloc_op_hints.at(i).alloc_level_ &&
} alloc_op_hints.at(i).id_ == op_id_ &&
OB_FAIL(alloc_nodes_above(ctx, alloc_op_hints.at(i).flags_))) {
LOG_WARN("fail to alloc op at enumerate level", K(ret));
} }
for (int64_t i = 0; OB_SUCC(ret) && i < alloc_op_hints.count(); ++i) {
if (ObAllocOpHint::OB_DFO == alloc_op_hints.at(i).alloc_level_ &&
(log_op_def::LOG_EXCHANGE == type_ &&
static_cast<ObLogExchange*>(this)->is_consumer()) &&
OB_FAIL(alloc_nodes_above(ctx, alloc_op_hints.at(i).flags_))) {
LOG_WARN("fail to alloc op at dfo level", K(ret));
}
}
for (int64_t i = 0; OB_SUCC(ret) && i < alloc_op_hints.count(); ++i) {
if (ObAllocOpHint::OB_ENUMERATE == alloc_op_hints.at(i).alloc_level_ &&
alloc_op_hints.at(i).id_ == op_id_ &&
OB_FAIL(alloc_nodes_above(ctx, alloc_op_hints.at(i).flags_))) {
LOG_WARN("fail to alloc op at enumerate level", K(ret));
}
}
} else {
LOG_WARN("exist_refactored fail", K(ret));
} }
} }
return ret; return ret;
@ -5822,16 +5807,25 @@ int ObLogicalOperator::alloc_nodes_above(AllocOpContext& ctx, const uint64_t &fl
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (flags & ObAllocOpHint::OB_MATERIAL if (flags & ObAllocOpHint::OB_MATERIAL
&& !ctx.is_visited(op_id_, ObAllocOpHint::OB_MATERIAL)) { && !ctx.is_visited(op_id_, ObAllocOpHint::OB_MATERIAL)) {
if (OB_FAIL(allocate_material_node_above())) { ret = ctx.disabled_op_set_.exist_refactored(op_id_);
LOG_WARN("failed to allocate material above", K(ret)); if (OB_HASH_EXIST == ret) {
} else if (OB_FAIL(ctx.visit(op_id_, ObAllocOpHint::OB_MATERIAL))) { /*op cant not add material, skip*/
LOG_WARN("failed to visit alloc op", K(ret)); ret = OB_SUCCESS;
} else if (OB_HASH_NOT_EXIST == ret) {
ret = OB_SUCCESS;
if (OB_FAIL(allocate_material_node_above())) {
LOG_WARN("failed to allocate material above", K(ret));
} else if (OB_FAIL(ctx.visit(op_id_, ObAllocOpHint::OB_MATERIAL))) {
LOG_WARN("failed to visit alloc op", K(ret));
}
} else {
LOG_WARN("exist_refactored fail", K(ret));
} }
} }
if (OB_SUCC(ret) if (OB_SUCC(ret)
&& ((flags & ObAllocOpHint::OB_MONITOR_STAT) && ((flags & ObAllocOpHint::OB_MONITOR_STAT)
|| (flags & ObAllocOpHint::OB_MONITOR_TRACING)) || (flags & ObAllocOpHint::OB_MONITOR_TRACING))
&& !ctx.is_visited(op_id_, ObAllocOpHint::OB_MONITOR_STAT | ObAllocOpHint::OB_MONITOR_TRACING)) { && !ctx.is_visited(op_id_, ObAllocOpHint::OB_MONITOR_STAT | ObAllocOpHint::OB_MONITOR_TRACING)) {
if (OB_FAIL(allocate_monitoring_dump_node_above(flags, op_id_))) { if (OB_FAIL(allocate_monitoring_dump_node_above(flags, op_id_))) {
LOG_WARN("failed to allocate monitoring dump above", K(ret)); LOG_WARN("failed to allocate monitoring dump above", K(ret));
} else if (OB_FAIL(ctx.visit(op_id_, ObAllocOpHint::OB_MONITOR_STAT | ObAllocOpHint::OB_MONITOR_TRACING))) { } else if (OB_FAIL(ctx.visit(op_id_, ObAllocOpHint::OB_MONITOR_STAT | ObAllocOpHint::OB_MONITOR_TRACING))) {