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 c55ff1615a0ea6dbec064bee1d406c54135b70da
Author: huanghaibin <[email protected]>
AuthorDate: Wed Sep 27 16:50:18 2023 +0800

    [improvement](compaction) output tablet_id when be core dumped. (#24952)
---
 be/src/common/signal_handler.h | 4 ++++
 be/src/olap/schema_change.cpp  | 3 +++
 be/src/olap/tablet.cpp         | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/be/src/common/signal_handler.h b/be/src/common/signal_handler.h
index 1c721a691a1..013b0e1c642 100644
--- a/be/src/common/signal_handler.h
+++ b/be/src/common/signal_handler.h
@@ -53,6 +53,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;
 
 namespace {
 
@@ -243,6 +244,9 @@ void DumpTimeInfo() {
     formatter.AppendString("-");
     formatter.AppendUint64(query_id_lo, 16);
     formatter.AppendString(" ***\n");
+    formatter.AppendString("*** tablet id: ");
+    formatter.AppendUint64(tablet_id, 10);
+    formatter.AppendString(" ***\n");
     formatter.AppendString("*** Aborted at ");
     formatter.AppendUint64(static_cast<uint64>(time_in_sec), 10);
     formatter.AppendString(" (unix time)");
diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp
index 48cb9367ae0..9650e1a400e 100644
--- a/be/src/olap/schema_change.cpp
+++ b/be/src/olap/schema_change.cpp
@@ -29,6 +29,7 @@
 #include <tuple>
 
 #include "common/logging.h"
+#include "common/signal_handler.h"
 #include "common/status.h"
 #include "gutil/hash/hash.h"
 #include "gutil/integral_types.h"
@@ -681,6 +682,8 @@ Status 
SchemaChangeHandler::_do_process_alter_tablet_v2(const TAlterTabletReqV2&
                                               request.base_tablet_id);
     }
 
+    signal::tablet_id = base_tablet->get_table_id();
+
     // new tablet has to exist
     TabletSharedPtr new_tablet =
             
StorageEngine::instance()->tablet_manager()->get_tablet(request.new_tablet_id);
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 7845bd7e585..a0bd03ae2c5 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -62,6 +62,7 @@
 #include "common/config.h"
 #include "common/consts.h"
 #include "common/logging.h"
+#include "common/signal_handler.h"
 #include "common/status.h"
 #include "gutil/ref_counted.h"
 #include "gutil/strings/stringpiece.h"
@@ -1839,6 +1840,7 @@ std::vector<Version> Tablet::get_all_versions() {
 }
 
 void Tablet::execute_compaction(CompactionType compaction_type) {
+    signal::tablet_id = tablet_id();
     if (compaction_type == CompactionType::CUMULATIVE_COMPACTION) {
         MonotonicStopWatch watch;
         watch.start();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to