This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit acda8d2129d90186b66131f7e145e50f507cf3c5
Author: Mryange <59914473+mrya...@users.noreply.github.com>
AuthorDate: Thu Jan 11 21:04:30 2024 +0800

    [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.
---
 .../java/org/apache/doris/common/profile/Profile.java | 19 +++++++++++++++----
 .../java/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 383880b2c82..19a51a1aaa6 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<Integer, String> 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 d4b8dc0acea..fbd4ce6a0f0 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;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to