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/07/14 02:55:33 UTC

[doris] branch master updated: [improvement]output query_id when be core dumped. (#10822)

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 3d52bff8d1 [improvement]output query_id when be core dumped. (#10822)
3d52bff8d1 is described below

commit 3d52bff8d1473bdb12279c7f5031206e490e2671
Author: Tiewei Fang <43...@users.noreply.github.com>
AuthorDate: Thu Jul 14 10:55:28 2022 +0800

    [improvement]output query_id when be core dumped. (#10822)
---
 be/src/common/signal_handler.h  | 10 +++++++++-
 be/src/runtime/fragment_mgr.cpp |  5 +++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/be/src/common/signal_handler.h b/be/src/common/signal_handler.h
index 7b49003159..37762244a1 100644
--- a/be/src/common/signal_handler.h
+++ b/be/src/common/signal_handler.h
@@ -51,6 +51,9 @@
 
 namespace doris::signal {
 
+inline thread_local uint64 query_id_hi;
+inline thread_local uint64 query_id_lo;
+
 namespace {
 
 // We'll install the failure signal handler for these signals.  We could
@@ -250,6 +253,11 @@ void DumpTimeInfo() {
     time_t time_in_sec = time(NULL);
     char buf[256]; // Big enough for time info.
     MinimalFormatter formatter(buf, sizeof(buf));
+    formatter.AppendString("*** Query id: ");
+    formatter.AppendUint64(query_id_hi, 16);
+    formatter.AppendString("-");
+    formatter.AppendUint64(query_id_lo, 16);
+    formatter.AppendString(" ***\n");
     formatter.AppendString("*** Aborted at ");
     formatter.AppendUint64(static_cast<uint64>(time_in_sec), 10);
     formatter.AppendString(" (unix time)");
@@ -421,7 +429,7 @@ void FailureSignalHandler(int signal_number, siginfo_t* signal_info, void* ucont
 
 } // namespace
 
-void InstallFailureSignalHandler() {
+inline void InstallFailureSignalHandler() {
     // Build the sigaction struct.
     struct sigaction sig_action;
     memset(&sig_action, 0, sizeof(sig_action));
diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp
index f7faec86a9..7d1cd44002 100644
--- a/be/src/runtime/fragment_mgr.cpp
+++ b/be/src/runtime/fragment_mgr.cpp
@@ -26,6 +26,7 @@
 #include "agent/cgroups_mgr.h"
 #include "common/object_pool.h"
 #include "common/resource_tls.h"
+#include "common/signal_handler.h"
 #include "gen_cpp/DataSinks_types.h"
 #include "gen_cpp/FrontendService.h"
 #include "gen_cpp/HeartbeatService.h"
@@ -484,6 +485,10 @@ void FragmentMgr::_exec_actual(std::shared_ptr<FragmentExecState> exec_state, Fi
     span->SetAttribute("query_id", print_id(exec_state->query_id()));
     span->SetAttribute("instance_id", print_id(exec_state->fragment_instance_id()));
 
+    // these two are used to output query_id when be cored dump.
+    doris::signal::query_id_hi = exec_state->query_id().hi;
+    doris::signal::query_id_lo = exec_state->query_id().lo;
+
     TAG(LOG(INFO))
             .log(std::move(func_name))
             .query_id(exec_state->query_id())


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