yiguolei commented on code in PR #33690: URL: https://github.com/apache/doris/pull/33690#discussion_r1685990262
########## fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java: ########## @@ -57,20 +68,47 @@ public class Profile { private static final Logger LOG = LogManager.getLogger(Profile.class); private static final int MergedProfileLevel = 1; - private final String name; - private SummaryProfile summaryProfile; - private List<ExecutionProfile> executionProfiles = Lists.newArrayList(); - private boolean isFinished; - private Map<Integer, String> planNodeMap; + // profile file name format: time_id + private static final String SEPERATOR = "_"; + // id will be assgined to id of SummaryProfile. + // For broker load, its SummaryPRofile id is a string representation of a long integer, + // for others, it is queryID + private String id = ""; + // summaryProfile will be serialized to storage as JSON, and we can recover it from storage + // recover of SummaryProfile is important, because it contains the meta information of the profile + // we need it to construct memory index for profile retrieving. + private SummaryProfile summaryProfile = new SummaryProfile(); + // executionProfiles will be stored to storage as string, when geting profile content, we will read + // from storage directly. + private List<ExecutionProfile> executionProfiles = Lists.newArrayList(); + // profileStoragePath will only be assigned when: + // 1. profile is stored to storage + // 2. or profile is loaded from storage + private String profileStoragePath = ""; + // isFinished means the coordinator or stmtexecutor is finished. + // does not mean the profile report has finished, since the report is async. + private boolean isFinished = false; + // when coordinator finishes, it will mark finish time. + // we will wait for about 5 seconds to see if all profiles have been reported. + // if not, we will store the profile to storage, and release the memory, + // futher report will be ignored. + // why MIN_VALUE? So that we can use PriorityQueue to sort profile by finish time. + private long queryFinishTimestamp = Long.MIN_VALUE; + private long profileStoreTimestamp = Long.MIN_VALUE; + private Map<Integer, String> planNodeMap = Maps.newHashMap(); private int profileLevel = 3; + private long autoProfileDurationMs = 500; - public Profile(String name, boolean isEnable, int profileLevel) { - this.name = name; + // Need default constructor for read from storage + public Profile() {} + + public Profile(boolean isEnable, int profileLevel, long autoProfileDurationMs) { Review Comment: 为什么把name 删了? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org