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 076946271ee [enhancement](util) print if using nereids planner when be 
coredump (#31981)
076946271ee is described below

commit 076946271eee552d031955cd3f9644bb39af5bcb
Author: TengJianPing <18241664+jackte...@users.noreply.github.com>
AuthorDate: Fri Mar 8 23:42:11 2024 +0800

    [enhancement](util) print if using nereids planner when be coredump (#31981)
---
 be/src/common/signal_handler.h    | 8 ++++++++
 be/src/runtime/fragment_mgr.cpp   | 4 +++-
 be/src/runtime/query_context.cpp  | 3 ++-
 be/src/runtime/query_context.h    | 6 +++++-
 be/src/runtime/runtime_state.cpp  | 4 ++++
 be/src/runtime/runtime_state.h    | 1 +
 be/src/runtime/thread_context.cpp | 1 +
 7 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/be/src/common/signal_handler.h b/be/src/common/signal_handler.h
index dad48c163cb..7663467b79a 100644
--- a/be/src/common/signal_handler.h
+++ b/be/src/common/signal_handler.h
@@ -54,6 +54,7 @@ namespace doris::signal {
 inline thread_local uint64 query_id_hi;
 inline thread_local uint64 query_id_lo;
 inline thread_local int64_t tablet_id = 0;
+inline thread_local bool is_nereids = false;
 
 namespace {
 
@@ -244,6 +245,9 @@ void DumpTimeInfo() {
     formatter.AppendString("-");
     formatter.AppendUint64(query_id_lo, 16);
     formatter.AppendString(" ***\n");
+    formatter.AppendString("*** is nereids: ");
+    formatter.AppendUint64(is_nereids, 10);
+    formatter.AppendString(" ***\n");
     formatter.AppendString("*** tablet id: ");
     formatter.AppendUint64(tablet_id, 10);
     formatter.AppendString(" ***\n");
@@ -436,6 +440,10 @@ inline void set_signal_task_id(TUniqueId tid) {
     query_id_lo = tid.lo;
 }
 
+inline void set_signal_is_nereids(bool is_nereids_arg) {
+    is_nereids = is_nereids_arg;
+}
+
 inline void InstallFailureSignalHandler() {
     // Build the sigaction struct.
     struct sigaction sig_action;
diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp
index ff28680f7aa..0f45973d292 100644
--- a/be/src/runtime/fragment_mgr.cpp
+++ b/be/src/runtime/fragment_mgr.cpp
@@ -612,7 +612,8 @@ Status FragmentMgr::_get_query_ctx(const Params& params, 
TUniqueId query_id, boo
         // This may be a first fragment request of the query.
         // Create the query fragments context.
         query_ctx = QueryContext::create_shared(query_id, 
params.fragment_num_on_host, _exec_env,
-                                                params.query_options, 
params.coord, pipeline);
+                                                params.query_options, 
params.coord, pipeline,
+                                                params.is_nereids);
         RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), 
params.desc_tbl,
                                               &(query_ctx->desc_tbl)));
         // set file scan range params
@@ -687,6 +688,7 @@ Status FragmentMgr::exec_plan_fragment(const 
TExecPlanFragmentParams& params,
     std::shared_ptr<QueryContext> query_ctx;
     bool pipeline_engine_enabled = 
params.query_options.__isset.enable_pipeline_engine &&
                                    params.query_options.enable_pipeline_engine;
+
     RETURN_IF_ERROR(
             _get_query_ctx(params, params.params.query_id, 
pipeline_engine_enabled, query_ctx));
     {
diff --git a/be/src/runtime/query_context.cpp b/be/src/runtime/query_context.cpp
index bca8b409c02..7dce8488eca 100644
--- a/be/src/runtime/query_context.cpp
+++ b/be/src/runtime/query_context.cpp
@@ -38,12 +38,13 @@ public:
 
 QueryContext::QueryContext(TUniqueId query_id, int total_fragment_num, 
ExecEnv* exec_env,
                            const TQueryOptions& query_options, TNetworkAddress 
coord_addr,
-                           bool is_pipeline)
+                           bool is_pipeline, bool is_nereids)
         : fragment_num(total_fragment_num),
           timeout_second(-1),
           _query_id(query_id),
           _exec_env(exec_env),
           _is_pipeline(is_pipeline),
+          _is_nereids(is_nereids),
           _query_options(query_options) {
     this->coord_addr = coord_addr;
     _start_time = VecDateTimeValue::local_time();
diff --git a/be/src/runtime/query_context.h b/be/src/runtime/query_context.h
index a7c855f4882..36c4f6ae110 100644
--- a/be/src/runtime/query_context.h
+++ b/be/src/runtime/query_context.h
@@ -70,7 +70,8 @@ class QueryContext {
 
 public:
     QueryContext(TUniqueId query_id, int total_fragment_num, ExecEnv* exec_env,
-                 const TQueryOptions& query_options, TNetworkAddress 
coord_addr, bool is_pipeline);
+                 const TQueryOptions& query_options, TNetworkAddress 
coord_addr, bool is_pipeline,
+                 bool is_nereids);
 
     ~QueryContext();
 
@@ -235,6 +236,8 @@ public:
         _merge_controller_handler = handler;
     }
 
+    bool is_nereids() const { return _is_nereids; }
+
     DescriptorTbl* desc_tbl = nullptr;
     bool set_rsc_info = false;
     std::string user;
@@ -269,6 +272,7 @@ private:
     VecDateTimeValue _start_time;
     int64_t _bytes_limit = 0;
     bool _is_pipeline = false;
+    bool _is_nereids = false;
 
     // A token used to submit olap scanner to the "_limited_scan_thread_pool",
     // This thread pool token is created from "_limited_scan_thread_pool" from 
exec env.
diff --git a/be/src/runtime/runtime_state.cpp b/be/src/runtime/runtime_state.cpp
index b04a7eed819..a39c0c58e7d 100644
--- a/be/src/runtime/runtime_state.cpp
+++ b/be/src/runtime/runtime_state.cpp
@@ -533,4 +533,8 @@ Status RuntimeState::register_consumer_runtime_filter(const 
doris::TRuntimeFilte
                                                                     
consumer_filter, false, false);
     }
 }
+
+bool RuntimeState::is_nereids() const {
+    return _query_ctx->is_nereids();
+}
 } // end namespace doris
diff --git a/be/src/runtime/runtime_state.h b/be/src/runtime/runtime_state.h
index bd54ca98e66..156a0998d4d 100644
--- a/be/src/runtime/runtime_state.h
+++ b/be/src/runtime/runtime_state.h
@@ -579,6 +579,7 @@ public:
     Status register_consumer_runtime_filter(const doris::TRuntimeFilterDesc& 
desc,
                                             bool need_local_merge, int node_id,
                                             doris::IRuntimeFilter** 
producer_filter);
+    bool is_nereids() const;
 
 private:
     Status create_error_log_file();
diff --git a/be/src/runtime/thread_context.cpp 
b/be/src/runtime/thread_context.cpp
index cd03c67b993..fca09fcabc5 100644
--- a/be/src/runtime/thread_context.cpp
+++ b/be/src/runtime/thread_context.cpp
@@ -33,6 +33,7 @@ AttachTask::AttachTask(const 
std::shared_ptr<MemTrackerLimiter>& mem_tracker,
 AttachTask::AttachTask(RuntimeState* runtime_state) {
     ThreadLocalHandle::create_thread_local_if_not_exits();
     signal::set_signal_task_id(runtime_state->query_id());
+    signal::set_signal_is_nereids(runtime_state->is_nereids());
     thread_context()->attach_task(runtime_state->query_id(), 
runtime_state->fragment_instance_id(),
                                   runtime_state->query_mem_tracker());
 }


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

Reply via email to