You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/10/21 14:48:52 UTC

[doris] branch branch-1.1-lts updated: [fix](profile) fix query instance profile may be lost. (#12418) (#13501)

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

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


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new cbc277d022 [fix](profile) fix query instance profile may be lost. (#12418) (#13501)
cbc277d022 is described below

commit cbc277d02219ac19b5aead89da9a0c2af57adb4e
Author: luozenglin <37...@users.noreply.github.com>
AuthorDate: Fri Oct 21 22:48:45 2022 +0800

    [fix](profile) fix query instance profile may be lost. (#12418) (#13501)
---
 .../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 6302268452..f96065f5ba 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
@@ -249,8 +249,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);
         }
     }
 
@@ -417,6 +421,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());
                     }
                 }
@@ -1384,6 +1392,7 @@ public class StmtExecutor implements ProfileWriter {
                  */
                 throwable = t;
             } finally {
+                endProfile(true);
                 QeProcessorImpl.INSTANCE.unregisterQuery(context.queryId());
             }
 


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