You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/05/06 09:20:47 UTC

[incubator-doris] 08/11: [improvement] set name for scanner threads and fix compile error in clang (#9336)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit b925413d9c429065753d7066acfb02420cc33129
Author: dataroaring <98...@users.noreply.github.com>
AuthorDate: Thu May 5 09:53:43 2022 +0800

    [improvement] set name for scanner threads and fix compile error in clang (#9336)
---
 be/src/exec/base_scanner.h       | 2 +-
 be/src/exec/broker_scan_node.cpp | 2 ++
 be/src/exec/broker_scanner.h     | 3 ++-
 be/src/util/thread.cpp           | 4 ++++
 be/src/util/thread.h             | 2 ++
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/be/src/exec/base_scanner.h b/be/src/exec/base_scanner.h
index 21abf080f9..bf3380e077 100644
--- a/be/src/exec/base_scanner.h
+++ b/be/src/exec/base_scanner.h
@@ -54,7 +54,7 @@ public:
     virtual Status open();
 
     // Get next tuple
-    virtual Status get_next(Tuple* tuple, MemPool* tuple_pool, bool* eof, bool *fill_tuple) = 0;
+    virtual Status get_next(Tuple* tuple, MemPool* tuple_pool, bool* eof, bool* fill_tuple) = 0;
 
     // Close this scanner
     virtual void close() = 0;
diff --git a/be/src/exec/broker_scan_node.cpp b/be/src/exec/broker_scan_node.cpp
index 11928480d8..0ecd7ba875 100644
--- a/be/src/exec/broker_scan_node.cpp
+++ b/be/src/exec/broker_scan_node.cpp
@@ -31,6 +31,7 @@
 #include "runtime/row_batch.h"
 #include "runtime/runtime_state.h"
 #include "util/runtime_profile.h"
+#include "util/thread.h"
 
 namespace doris {
 
@@ -247,6 +248,7 @@ Status BrokerScanNode::scanner_scan(const TBrokerScanRange& scan_range,
                                     const std::vector<ExprContext*>& conjunct_ctxs,
                                     ScannerCounter* counter) {
     //create scanner object and open
+    Thread::set_self_name("broker_scanner");
     std::unique_ptr<BaseScanner> scanner = create_scanner(scan_range, counter);
     RETURN_IF_ERROR(scanner->open());
     bool scanner_eof = false;
diff --git a/be/src/exec/broker_scanner.h b/be/src/exec/broker_scanner.h
index 7bc194f289..c5aa786b10 100644
--- a/be/src/exec/broker_scanner.h
+++ b/be/src/exec/broker_scanner.h
@@ -63,7 +63,8 @@ public:
     Status open() override;
 
     // Get next tuple
-    Status get_next(Tuple* tuple, MemPool* tuple_pool, bool* eof, bool* fill_tuple) override;
+    virtual Status get_next(Tuple* tuple, MemPool* tuple_pool, bool* eof,
+                            bool* fill_tuple) override;
 
     // Close this scanner
     void close() override;
diff --git a/be/src/util/thread.cpp b/be/src/util/thread.cpp
index 9e35cc134b..a8d79fc6a5 100644
--- a/be/src/util/thread.cpp
+++ b/be/src/util/thread.cpp
@@ -256,6 +256,10 @@ Thread::~Thread() {
     }
 }
 
+void Thread::set_self_name(const std::string& name) {
+    ThreadMgr::set_thread_name(name, current_thread_id());
+}
+
 void Thread::join() {
     ThreadJoiner(this).join();
 }
diff --git a/be/src/util/thread.h b/be/src/util/thread.h
index c890f81286..f3f76d12d9 100644
--- a/be/src/util/thread.h
+++ b/be/src/util/thread.h
@@ -85,6 +85,8 @@ public:
         return start_thread(category, name, std::bind(f, a1, a2, a3, a4, a5, a6), NO_FLAGS, holder);
     }
 
+    static void set_self_name(const std::string& name);
+
     ~Thread();
 
     // Blocks until this thread finishes execution. Once this method returns, the thread


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