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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0c260152b7 [fix](profile) fix query instance profile may be lost. 
(#12418)
0c260152b7 is described below

commit 0c260152b7d07f424456d2543633f0d279e43902
Author: luozenglin <37725793+luozeng...@users.noreply.github.com>
AuthorDate: Fri Sep 9 22:58:04 2022 +0800

    [fix](profile) fix query instance profile may be lost. (#12418)
---
 .../src/main/java/org/apache/doris/qe/StmtExecutor.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 76b3106dbd..93779ad212 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -245,8 +245,12 @@ public class StmtExecutor implements ProfileWriter {
         plannerProfile.initRuntimeProfile(plannerRuntimeProfile);
 
         
queryProfile.getCounterTotalTime().setValue(TimeUtils.getEstimatedTime(plannerProfile.getQueryBeginTime()));
-        if (coord != null) {
-            coord.endProfile(waiteBeReport);
+        endProfile(waiteBeReport);
+    }
+
+    private void endProfile(boolean waitProfileDone) {
+        if (context != null && context.getSessionVariable().enableProfile() && 
coord != null) {
+            coord.endProfile(waitProfileDone);
         }
     }
 
@@ -466,6 +470,10 @@ public class StmtExecutor implements ProfileWriter {
                             throw e;
                         }
                     } finally {
+                        // The final profile report occurs after be returns 
the query data, and the profile cannot be
+                        // received after unregisterQuery(), causing the 
instance profile to be lost, so we should wait
+                        // for the profile before unregisterQuery().
+                        endProfile(true);
                         
QeProcessorImpl.INSTANCE.unregisterQuery(context.queryId());
                     }
                 }
@@ -1472,6 +1480,7 @@ public class StmtExecutor implements ProfileWriter {
                  */
                 throwable = t;
             } finally {
+                endProfile(true);
                 QeProcessorImpl.INSTANCE.unregisterQuery(context.queryId());
             }
 


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

Reply via email to