This is an automated email from the ASF dual-hosted git repository. eldenmoon pushed a commit to branch branch-2.0-var in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0-var by this push: new 089560206a set scanner thread name by thread pool, query type and query id suffix (#25164) 089560206a is described below commit 089560206a65a1c94838ff331cdbbfbd72e89eb2 Author: Kang <kxiao.ti...@gmail.com> AuthorDate: Tue Oct 10 14:34:30 2023 +0800 set scanner thread name by thread pool, query type and query id suffix (#25164) --- be/src/vec/exec/scan/scanner_scheduler.cpp | 24 ++++++++++++++++++------ be/src/vec/exec/scan/scanner_scheduler.h | 3 ++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/be/src/vec/exec/scan/scanner_scheduler.cpp b/be/src/vec/exec/scan/scanner_scheduler.cpp index c74bee0faa..960e672a1c 100644 --- a/be/src/vec/exec/scan/scanner_scheduler.cpp +++ b/be/src/vec/exec/scan/scanner_scheduler.cpp @@ -194,7 +194,12 @@ void ScannerScheduler::_schedule_scanners(ScannerContext* ctx) { while (iter != this_run.end()) { (*iter)->start_wait_worker_timer(); auto s = ctx->thread_token->submit_func( - [this, scanner = *iter, ctx] { this->_scanner_scan(this, ctx, scanner); }); + [this, scanner = *iter, ctx] { + std::stringstream ss; + ss << "ss0" << scanner->runtime_state()->query_type() + << scanner->runtime_state()->query_id().lo%(int64_t)100000; + this->_scanner_scan(this, ctx, scanner, ss.str()); + }); if (s.ok()) { this_run.erase(iter++); } else { @@ -210,13 +215,19 @@ void ScannerScheduler::_schedule_scanners(ScannerContext* ctx) { if (type == TabletStorageType::STORAGE_TYPE_LOCAL) { PriorityThreadPool::Task task; task.work_function = [this, scanner = *iter, ctx] { - this->_scanner_scan(this, ctx, scanner); + std::stringstream ss; + ss << "ss1" << scanner->runtime_state()->query_type() + << scanner->runtime_state()->query_id().lo%(int64_t)100000; + this->_scanner_scan(this, ctx, scanner, ss.str()); }; task.priority = nice; ret = _local_scan_thread_pool->offer(task); } else { ret = _remote_scan_thread_pool->submit_func([this, scanner = *iter, ctx] { - this->_scanner_scan(this, ctx, scanner); + std::stringstream ss; + ss << "ss2" << scanner->runtime_state()->query_type() + << scanner->runtime_state()->query_id().lo%(int64_t)100000; + this->_scanner_scan(this, ctx, scanner, ss.str()); }); } if (ret) { @@ -271,13 +282,13 @@ void ScannerScheduler::_schedule_scanners(ScannerContext* ctx) { } void ScannerScheduler::_scanner_scan(ScannerScheduler* scheduler, ScannerContext* ctx, - VScannerSPtr scanner) { + VScannerSPtr scanner, const std::string thread_name) { SCOPED_ATTACH_TASK(scanner->runtime_state()); #if !defined(USE_BTHREAD_SCANNER) - Thread::set_self_name("_scanner_scan"); + Thread::set_self_name(thread_name); #else if (dynamic_cast<NewOlapScanner*>(scanner) == nullptr) { - Thread::set_self_name("_scanner_scan"); + Thread::set_self_name(thread_name); } #endif #ifndef __APPLE__ @@ -399,6 +410,7 @@ void ScannerScheduler::_scanner_scan(ScannerScheduler* scheduler, ScannerContext } ctx->push_back_scanner_and_reschedule(scanner); + Thread::set_self_name("idle_scanner_scan"); } } // namespace doris::vectorized diff --git a/be/src/vec/exec/scan/scanner_scheduler.h b/be/src/vec/exec/scan/scanner_scheduler.h index 8c66814bf5..16b40ba097 100644 --- a/be/src/vec/exec/scan/scanner_scheduler.h +++ b/be/src/vec/exec/scan/scanner_scheduler.h @@ -73,7 +73,8 @@ private: // schedule scanners in a certain ScannerContext void _schedule_scanners(ScannerContext* ctx); // execution thread function - void _scanner_scan(ScannerScheduler* scheduler, ScannerContext* ctx, VScannerSPtr scanner); + void _scanner_scan(ScannerScheduler* scheduler, ScannerContext* ctx, VScannerSPtr scanner, + const std::string thread_name); private: // Scheduling queue number. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org