This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
new 2cbe2e2d61 support be.out query_id (#14656)
2cbe2e2d61 is described below
commit 2cbe2e2d61002e7b625c1908f5bcdd0b97d22f85
Author: Tiewei Fang <[email protected]>
AuthorDate: Tue Nov 29 08:49:55 2022 +0800
support be.out query_id (#14656)
---
be/src/common/signal_handler.h | 10 +++++++++-
be/src/runtime/fragment_mgr.cpp | 6 ++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/be/src/common/signal_handler.h b/be/src/common/signal_handler.h
index 68c7737d59..43415d4000 100644
--- a/be/src/common/signal_handler.h
+++ b/be/src/common/signal_handler.h
@@ -50,6 +50,9 @@ namespace doris::signal {
namespace {
+inline thread_local uint64 query_id_hi;
+inline thread_local uint64 query_id_lo;
+
// We'll install the failure signal handler for these signals. We could
// use strsignal() to get signal names, but we don't use it to avoid
// introducing yet another #ifdef complication.
@@ -254,6 +257,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)");
@@ -429,7 +437,7 @@ void FailureSignalHandler(int signal_number,
} // 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 93db38f4e9..5e9b525e04 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"
@@ -471,6 +472,11 @@ void
FragmentMgr::_exec_actual(std::shared_ptr<FragmentExecState> exec_state, Fi
#ifndef BE_TEST
SCOPED_ATTACH_TASK(exec_state->executor()->runtime_state());
#endif
+
+ // 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("PlanFragmentExecutor::_exec_actual")
.query_id(exec_state->query_id())
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]