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 729b9e979cc0095c273fe1bbfc71558da2bba790
Author: Xinyi Zou <zouxiny...@gmail.com>
AuthorDate: Mon Jul 31 18:29:38 2023 +0800

    [fix](load) load core dump print load id (#22388)
    
    save the load id to the thread context,
    expect all task ids to be saved in thread context, compaction/schema 
change/etc.
---
 be/src/common/signal_handler.h      | 10 ++++++++++
 be/src/runtime/thread_context.cpp   |  4 ++--
 be/src/service/internal_service.cpp |  4 ++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/be/src/common/signal_handler.h b/be/src/common/signal_handler.h
index dbc7f4db57..1c721a691a 100644
--- a/be/src/common/signal_handler.h
+++ b/be/src/common/signal_handler.h
@@ -422,6 +422,16 @@ void FailureSignalHandler(int signal_number, siginfo_t* 
signal_info, void* ucont
 
 } // namespace
 
+inline void set_signal_task_id(PUniqueId tid) {
+    query_id_hi = tid.hi();
+    query_id_lo = tid.lo();
+}
+
+inline void set_signal_task_id(TUniqueId tid) {
+    query_id_hi = tid.hi;
+    query_id_lo = tid.lo;
+}
+
 inline void InstallFailureSignalHandler() {
     // Build the sigaction struct.
     struct sigaction sig_action;
diff --git a/be/src/runtime/thread_context.cpp 
b/be/src/runtime/thread_context.cpp
index c2dd13770c..a092385f41 100644
--- a/be/src/runtime/thread_context.cpp
+++ b/be/src/runtime/thread_context.cpp
@@ -33,13 +33,13 @@ ThreadContextPtr::ThreadContextPtr() {
 AttachTask::AttachTask(const std::shared_ptr<MemTrackerLimiter>& mem_tracker,
                        const TUniqueId& task_id, const TUniqueId& 
fragment_instance_id) {
     SwitchBthreadLocal::switch_to_bthread_local();
+    signal::set_signal_task_id(task_id);
     thread_context()->attach_task(task_id, fragment_instance_id, mem_tracker);
 }
 
 AttachTask::AttachTask(RuntimeState* runtime_state) {
     SwitchBthreadLocal::switch_to_bthread_local();
-    doris::signal::query_id_hi = runtime_state->query_id().hi;
-    doris::signal::query_id_lo = runtime_state->query_id().lo;
+    signal::set_signal_task_id(runtime_state->query_id());
     thread_context()->attach_task(runtime_state->query_id(), 
runtime_state->fragment_instance_id(),
                                   runtime_state->query_mem_tracker());
 }
diff --git a/be/src/service/internal_service.cpp 
b/be/src/service/internal_service.cpp
index 2d0b20ce8f..3a22919ea2 100644
--- a/be/src/service/internal_service.cpp
+++ b/be/src/service/internal_service.cpp
@@ -51,6 +51,7 @@
 #include "common/config.h"
 #include "common/exception.h"
 #include "common/logging.h"
+#include "common/signal_handler.h"
 #include "common/status.h"
 #include "gutil/integral_types.h"
 #include "http/http_client.h"
@@ -233,6 +234,7 @@ void 
PInternalServiceImpl::tablet_writer_open(google::protobuf::RpcController* c
     bool ret = _light_work_pool.try_offer([this, request, response, done]() {
         VLOG_RPC << "tablet writer open, id=" << request->id()
                  << ", index_id=" << request->index_id() << ", txn_id=" << 
request->txn_id();
+        signal::set_signal_task_id(request->id());
         brpc::ClosureGuard closure_guard(done);
         auto st = _exec_env->load_channel_mgr()->open(*request);
         if (!st.ok()) {
@@ -373,6 +375,7 @@ void 
PInternalServiceImpl::_tablet_writer_add_block(google::protobuf::RpcControl
         int64_t execution_time_ns = 0;
         {
             SCOPED_RAW_TIMER(&execution_time_ns);
+            signal::set_signal_task_id(request->id());
             auto st = _exec_env->load_channel_mgr()->add_batch(*request, 
response);
             if (!st.ok()) {
                 LOG(WARNING) << "tablet writer add block failed, message=" << 
st
@@ -400,6 +403,7 @@ void 
PInternalServiceImpl::tablet_writer_cancel(google::protobuf::RpcController*
     bool ret = _light_work_pool.try_offer([this, request, done]() {
         VLOG_RPC << "tablet writer cancel, id=" << request->id()
                  << ", index_id=" << request->index_id() << ", sender_id=" << 
request->sender_id();
+        signal::set_signal_task_id(request->id());
         brpc::ClosureGuard closure_guard(done);
         auto st = _exec_env->load_channel_mgr()->cancel(*request);
         if (!st.ok()) {


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

Reply via email to