From acda8d2129d90186b66131f7e145e50f507cf3c5 Mon Sep 17 00:00:00 2001 From: Mryange <59914473+Mryange@users.noreply.github.com> Date: Thu, 11 Jan 2024 21:04:30 +0800 Subject: [PATCH] [feature](profile )merge of profiles can be disabled by profile level. #29861 The merging of profiles requires ensuring the correctness of the profiles themselves. However, if merging is intended for troubleshooting correctness issues through profiles, errors may occur. Moreover, the 'try-catch' does not catch exceptions related to profile merging. If merging fails, even the normal profile cannot be obtained. --- .../apache/doris/common/profile/Profile.java | 19 +++++++++++++++---- .../org/apache/doris/qe/SessionVariable.java | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java b/fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java index 383880b2c8..19a51a1aaa 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java @@ -42,6 +42,7 @@ import java.util.Map; */ public class Profile { private static final Logger LOG = LogManager.getLogger(Profile.class); + private static final int MergedProfileLevel = 1; private RuntimeProfile rootProfile; private SummaryProfile summaryProfile; private AggregatedProfile aggregatedProfile; @@ -49,6 +50,8 @@ public class Profile { private boolean isFinished; private Map planNodeMap; + private int profileLevel = 3; + public Profile(String name, boolean isEnable) { this.rootProfile = new RuntimeProfile(name); this.summaryProfile = new SummaryProfile(rootProfile); @@ -86,6 +89,7 @@ public class Profile { rootProfile.setIsPipelineX(isPipelineX); ProfileManager.getInstance().pushProfile(this); this.isFinished = isFinished; + this.profileLevel = profileLevel; } catch (Throwable t) { LOG.warn("update profile failed", t); throw t; @@ -105,14 +109,21 @@ public class Profile { // add summary to builder summaryProfile.prettyPrint(builder); LOG.info(builder.toString()); - builder.append("\n MergedProfile \n"); - aggregatedProfile.getAggregatedFragmentsProfile(planNodeMap).prettyPrint(builder, " "); + if (this.profileLevel == MergedProfileLevel) { + try { + builder.append("\n MergedProfile \n"); + aggregatedProfile.getAggregatedFragmentsProfile(planNodeMap).prettyPrint(builder, " "); + } catch (Throwable aggProfileException) { + LOG.warn("build merged simple profile failed", aggProfileException); + builder.append("build merged simple profile failed"); + } + } try { builder.append("\n"); executionProfile.getExecutionProfile().prettyPrint(builder, ""); } catch (Throwable aggProfileException) { - LOG.warn("build merged simple profile failed", aggProfileException); - builder.append("build merged simple profile failed"); + LOG.warn("build profile failed", aggProfileException); + builder.append("build profile failed"); } return builder.toString(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index d4b8dc0ace..fbd4ce6a0f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -715,7 +715,7 @@ public class SessionVariable implements Serializable, Writable { public int parallelPipelineTaskNum = 0; @VariableMgr.VarAttr(name = PROFILE_LEVEL, fuzzy = true) - public int profileLevel = 3; + public int profileLevel = 1; @VariableMgr.VarAttr(name = MAX_INSTANCE_NUM) public int maxInstanceNum = 64;