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 1d825f57bc [fix](load) expose error root cause msg for load (#22968)
1d825f57bc is described below

commit 1d825f57bc8d3cacb57e19f5499a3a7e355510b1
Author: zhengyu <freeman.zhang1...@gmail.com>
AuthorDate: Tue Aug 15 13:22:45 2023 +0800

    [fix](load) expose error root cause msg for load (#22968)
    
    Currently, we only return ambiguous "INTERNAL ERROR" to the user when
    load. This commit will no more hide the root cause.
    
    Signed-off-by: freemandealer <freeman.zhang1...@gmail.com>
---
 be/src/pipeline/pipeline_fragment_context.cpp | 4 ++--
 be/src/runtime/fragment_mgr.cpp               | 5 +++--
 be/src/runtime/plan_fragment_executor.cpp     | 2 +-
 be/src/runtime/runtime_state.h                | 4 ++--
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/be/src/pipeline/pipeline_fragment_context.cpp 
b/be/src/pipeline/pipeline_fragment_context.cpp
index ae91ab3381..d37410edb1 100644
--- a/be/src/pipeline/pipeline_fragment_context.cpp
+++ b/be/src/pipeline/pipeline_fragment_context.cpp
@@ -157,7 +157,7 @@ void PipelineFragmentContext::cancel(const 
PPlanFragmentCancelReason& reason,
         if (reason != PPlanFragmentCancelReason::LIMIT_REACH) {
             _exec_status = Status::Cancelled(msg);
         }
-        _runtime_state->set_is_cancelled(true);
+        _runtime_state->set_is_cancelled(true, msg);
 
         LOG(WARNING) << "PipelineFragmentContext Canceled. reason=" << msg;
 
@@ -172,7 +172,7 @@ void PipelineFragmentContext::cancel(const 
PPlanFragmentCancelReason& reason,
         // For stream load the fragment's query_id == load id, it is set in FE.
         auto stream_load_ctx = 
_exec_env->new_load_stream_mgr()->get(_query_id);
         if (stream_load_ctx != nullptr) {
-            
stream_load_ctx->pipe->cancel(PPlanFragmentCancelReason_Name(reason));
+            stream_load_ctx->pipe->cancel(msg);
         }
         _cancel_reason = reason;
         _cancel_msg = msg;
diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp
index 9b184f6c33..c8fb7ac9ac 100644
--- a/be/src/runtime/fragment_mgr.cpp
+++ b/be/src/runtime/fragment_mgr.cpp
@@ -266,7 +266,8 @@ Status FragmentExecState::execute() {
                       strings::Substitute("Got error while opening fragment 
$0, query id: $1",
                                           print_id(_fragment_instance_id), 
print_id(_query_id)));
         if (!st.ok()) {
-            cancel(PPlanFragmentCancelReason::INTERNAL_ERROR, 
"PlanFragmentExecutor open failed");
+            cancel(PPlanFragmentCancelReason::INTERNAL_ERROR,
+                   fmt::format("PlanFragmentExecutor open failed, reason: {}", 
st.to_string()));
         }
         _executor.close();
     }
@@ -287,7 +288,7 @@ Status FragmentExecState::cancel(const 
PPlanFragmentCancelReason& reason, const
         // For stream load the fragment's query_id == load id, it is set in FE.
         auto stream_load_ctx = 
_query_ctx->exec_env()->new_load_stream_mgr()->get(_query_id);
         if (stream_load_ctx != nullptr) {
-            
stream_load_ctx->pipe->cancel(PPlanFragmentCancelReason_Name(reason));
+            stream_load_ctx->pipe->cancel(msg);
         }
 #endif
         _cancelled = true;
diff --git a/be/src/runtime/plan_fragment_executor.cpp 
b/be/src/runtime/plan_fragment_executor.cpp
index aba0893046..f4eb2dffa5 100644
--- a/be/src/runtime/plan_fragment_executor.cpp
+++ b/be/src/runtime/plan_fragment_executor.cpp
@@ -496,7 +496,7 @@ void PlanFragmentExecutor::cancel(const 
PPlanFragmentCancelReason& reason, const
     DCHECK(_prepared);
     _cancel_reason = reason;
     _cancel_msg = msg;
-    _runtime_state->set_is_cancelled(true);
+    _runtime_state->set_is_cancelled(true, msg);
     // To notify wait_for_start()
     _runtime_state->get_query_ctx()->set_ready_to_execute(true);
 
diff --git a/be/src/runtime/runtime_state.h b/be/src/runtime/runtime_state.h
index 6ef4ee1081..1f35f6c1b8 100644
--- a/be/src/runtime/runtime_state.h
+++ b/be/src/runtime/runtime_state.h
@@ -160,11 +160,11 @@ public:
 
     bool is_cancelled() const { return _is_cancelled.load(); }
     int codegen_level() const { return _query_options.codegen_level; }
-    void set_is_cancelled(bool v) {
+    void set_is_cancelled(bool v, std::string msg) {
         _is_cancelled.store(v);
         // Create a error status, so that we could print error stack, and
         // we could know which path call cancel.
-        LOG(INFO) << "task is cancelled, st = " << 
Status::Error<ErrorCode::CANCELLED>("");
+        LOG(INFO) << "task is cancelled, st = " << 
Status::Error<ErrorCode::CANCELLED>(msg);
     }
 
     void set_backend_id(int64_t backend_id) { _backend_id = backend_id; }


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

Reply via email to