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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 5d682156b43b476f2cf5d5c2dac7366ac3273ac3
Author: yiguolei <[email protected]>
AuthorDate: Sat Sep 9 17:12:35 2023 +0800

    [bugfix](insert into) should not send profile during report process (#24127)
    
    Co-authored-by: yiguolei <[email protected]>
---
 be/src/pipeline/pipeline_fragment_context.cpp                     | 5 +++--
 be/src/runtime/plan_fragment_executor.cpp                         | 1 -
 be/src/runtime/runtime_state.h                                    | 4 +++-
 fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java | 8 +++++++-
 gensrc/thrift/PaloInternalService.thrift                          | 3 +++
 5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/be/src/pipeline/pipeline_fragment_context.cpp 
b/be/src/pipeline/pipeline_fragment_context.cpp
index 0e84131401..f18f437ba4 100644
--- a/be/src/pipeline/pipeline_fragment_context.cpp
+++ b/be/src/pipeline/pipeline_fragment_context.cpp
@@ -856,8 +856,9 @@ void PipelineFragmentContext::send_report(bool done) {
     }
 
     _report_status_cb(
-            {exec_status, _is_report_success ? 
_runtime_state->runtime_profile() : nullptr,
-             _is_report_success ? _runtime_state->load_channel_profile() : 
nullptr,
+            {exec_status,
+             _runtime_state->enable_profile() ? 
_runtime_state->runtime_profile() : nullptr,
+             _runtime_state->enable_profile() ? 
_runtime_state->load_channel_profile() : nullptr,
              done || !exec_status.ok(), _query_ctx->coord_addr, _query_id, 
_fragment_id,
              _fragment_instance_id, _backend_num, _runtime_state.get(),
              std::bind(&PipelineFragmentContext::update_status, this, 
std::placeholders::_1),
diff --git a/be/src/runtime/plan_fragment_executor.cpp 
b/be/src/runtime/plan_fragment_executor.cpp
index f4eb2dffa5..77d1593830 100644
--- a/be/src/runtime/plan_fragment_executor.cpp
+++ b/be/src/runtime/plan_fragment_executor.cpp
@@ -465,7 +465,6 @@ void PlanFragmentExecutor::send_report(bool done) {
     if (!_is_report_success && !_is_report_on_cancel) {
         return;
     }
-
     // This will send a report even if we are cancelled.  If the query 
completed correctly
     // but fragments still need to be cancelled (e.g. limit reached), the 
coordinator will
     // be waiting for a final report and profile.
diff --git a/be/src/runtime/runtime_state.h b/be/src/runtime/runtime_state.h
index 0e7c6b7ab3..f1d49ac281 100644
--- a/be/src/runtime/runtime_state.h
+++ b/be/src/runtime/runtime_state.h
@@ -382,7 +382,9 @@ public:
 
     void set_tracer(OpentelemetryTracer&& tracer) { _tracer = 
std::move(tracer); }
 
-    bool enable_profile() const { return _query_options.is_report_success; }
+    bool enable_profile() const {
+        return _query_options.__isset.enable_profile && 
_query_options.enable_profile;
+    }
 
     bool enable_scan_node_run_serial() const {
         return _query_options.__isset.enable_scan_node_run_serial &&
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index 56711020f8..ae14802cf9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -2115,7 +2115,13 @@ public class SessionVariable implements Serializable, 
Writable {
         tResult.setBufferPoolLimit(maxExecMemByte);
 
         tResult.setQueryTimeout(queryTimeoutS);
-        tResult.setIsReportSuccess(enableProfile);
+        tResult.setEnableProfile(enableProfile);
+        if (enableProfile) {
+            // If enable profile == true, then also set report success to true
+            // be need report success to start report thread. But it is very 
tricky
+            // we should modify BE in the future.
+            tResult.setIsReportSuccess(true);
+        }
         tResult.setCodegenLevel(codegenLevel);
         tResult.setBeExecVersion(Config.be_exec_version);
         tResult.setEnablePipelineEngine(enablePipelineEngine);
diff --git a/gensrc/thrift/PaloInternalService.thrift 
b/gensrc/thrift/PaloInternalService.thrift
index 35acf17a86..e3a2f58059 100644
--- a/gensrc/thrift/PaloInternalService.thrift
+++ b/gensrc/thrift/PaloInternalService.thrift
@@ -242,6 +242,9 @@ struct TQueryOptions {
   82: optional i64 fe_process_uuid = 0;
 
   83: optional i32 inverted_index_conjunction_opt_threshold = 1000;
+  // A seperate flag to indicate whether to enable profile, not
+  // use is_report_success any more
+  84: optional bool enable_profile = false;
 }
 
 


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

Reply via email to