This is an automated email from the ASF dual-hosted git repository. yangzhg pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new 6ad1bf7 [Bug] Fix dead lock in olap scan node and refactor some code in FE profile (#5713) 6ad1bf7 is described below commit 6ad1bf7d7eef898fca8492fe1feff302435d34c4 Author: HappenLee <happen...@hotmail.com> AuthorDate: Fri Apr 30 10:12:18 2021 +0800 [Bug] Fix dead lock in olap scan node and refactor some code in FE profile (#5713) * [Bug] Fix dead lock in olap scan node and refactor some code in FE profile * Add some comment --- be/src/exec/olap_scan_node.cpp | 6 +++++- .../src/main/java/org/apache/doris/common/util/RuntimeProfile.java | 6 +++--- fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java | 2 -- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/be/src/exec/olap_scan_node.cpp b/be/src/exec/olap_scan_node.cpp index c10b7f0..8a8f386 100644 --- a/be/src/exec/olap_scan_node.cpp +++ b/be/src/exec/olap_scan_node.cpp @@ -1470,12 +1470,16 @@ void OlapScanNode::scanner_thread(OlapScanner* scanner) { _scan_cpu_timer->update(cpu_watch.elapsed_time()); _scanner_wait_worker_timer->update(wait_time); - _scan_batch_added_cv.notify_one(); // The transfer thead will wait for `_running_thread==0`, to make sure all scanner threads won't access class members. // Do not access class members after this code. std::unique_lock<std::mutex> l(_scan_batches_lock); _running_thread--; + // Both cv of _scan_batch_added_cv and _scan_thread_exit_cv should be notify after + // change the value of _running_thread, because transfer thread lock will check the value + // of _running_thread after be notify. Otherwise there could be dead lock between scanner_thread + // and transfer thread + _scan_batch_added_cv.notify_one(); _scan_thread_exit_cv.notify_one(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java index bafece3..68eb1a6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java @@ -344,15 +344,15 @@ public class RuntimeProfile { // Because the profile of summary and child fragment is not a real parent-child relationship // Each child profile needs to calculate the time proportion consumed by itself public void computeTimeInChildProfile() { - childMap.values().stream(). - forEach(child -> child.computeTimeInProfile()); + childMap.values(). + forEach(RuntimeProfile::computeTimeInProfile); } public void computeTimeInProfile() { computeTimeInProfile(this.counterTotalTime.getValue()); } - public void computeTimeInProfile(long total) { + private void computeTimeInProfile(long total) { if (total == 0) { return; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index f63b642..d97263e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -416,8 +416,6 @@ public class StmtExecutor { private void writeProfile() { initProfile(plannerProfile); profile.computeTimeInChildProfile(); - StringBuilder builder = new StringBuilder(); - profile.prettyPrint(builder, ""); ProfileManager.getInstance().pushProfile(profile); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org