fix concurrent problem of px target monitor

This commit is contained in:
obdev
2022-12-08 08:36:11 +00:00
committed by ob-robot
parent ea4e649833
commit b421987484
2 changed files with 17 additions and 5 deletions

View File

@ -593,7 +593,10 @@ int ObPxResourceAnalyzer::schedule_dfo(
const int64_t group = 1;
groups += group;
ObHashSet<ObAddr> &addr_set = dfo.location_addr_;
if (OB_FAIL(update_parallel_map(current_thread_map, addr_set, dfo.get_dop()))) {
// we assume that should allocate same thread count for each sqc in the dfo.
// this may not true. but we can't decide the real count for each sqc. just let it be for now
const int64_t dop_per_addr = 0 == addr_set.size() ? dfo.get_dop() : (dfo.get_dop() + addr_set.size() - 1) / addr_set.size();
if (OB_FAIL(update_parallel_map(current_thread_map, addr_set, dop_per_addr))) {
LOG_WARN("increase current thread map failed", K(ret));
} else if (OB_FAIL(update_parallel_map(current_group_map, addr_set, group))) {
LOG_WARN("increase current group map failed", K(ret));
@ -616,7 +619,8 @@ int ObPxResourceAnalyzer::finish_dfo(
const int64_t group = 1;
groups -= group;
ObHashSet<ObAddr> &addr_set = dfo.location_addr_;
if (OB_FAIL(update_parallel_map(current_thread_map, addr_set, -dfo.get_dop()))) {
const int64_t dop_per_addr = 0 == addr_set.size() ? dfo.get_dop() : (dfo.get_dop() + addr_set.size() - 1) / addr_set.size();
if (OB_FAIL(update_parallel_map(current_thread_map, addr_set, -dop_per_addr))) {
LOG_WARN("decrease current thread map failed", K(ret));
} else if (OB_FAIL(update_parallel_map(current_group_map, addr_set, -group))) {
LOG_WARN("decrease current group map failed", K(ret));