yiguolei commented on code in PR #39448:
URL: https://github.com/apache/doris/pull/39448#discussion_r1721475675


##########
fe/fe-core/src/main/java/org/apache/doris/common/util/ProfileManager.java:
##########
@@ -913,8 +905,98 @@ public void markExecutionProfileFinished(TUniqueId 
queryId) {
     }
 
     public String getLastProfileId() {
-        PriorityQueue<ProfileElement> queueIdDeque = 
getProfileOrderByQueryFinishTime();
+        PriorityQueue<ProfileElement> queueIdDeque = 
getProfileOrderByQueryFinishTimeDesc();
         ProfileElement profileElement = queueIdDeque.poll();
         return profileElement.profile.getSummaryProfile().getProfileId();
     }
+
+    private void preventExecutionProfileLeakage() {
+        StringBuilder stringBuilder = new StringBuilder();
+        int executionProfileNum = 0;
+        writeLock.lock();
+        try {
+            // This branch has two purposes:
+            // 1. discard profile collecting if its collection not finished in 
5 seconds after query finished.
+            // 2. prevent execution profile from leakage. If we have too many 
execution profiles in memory,
+            // we will remove execution profiles of query that has finished in 
5 seconds ago.
+            if (queryIdToExecutionProfiles.size() > 2 * 
Config.max_query_profile_num) {

Review Comment:
   这里不用加这个if 检查了,因为未来这个值可能很大



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to