[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.
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user