mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
enhance: Make segcore thread name set correctly (#42497)
Previous PR: #42017 did not work due to following updated points by this PR: - Initialize the `name_map`, which not touched at all before - Trim the thread name under 15 characters to fit syscall limit --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
cc5ac1c220
commit
b50c4a7973
@ -14,12 +14,12 @@
|
||||
//
|
||||
|
||||
#include "ThreadPools.h"
|
||||
#include <mutex>
|
||||
|
||||
namespace milvus {
|
||||
|
||||
std::map<ThreadPoolPriority, std::unique_ptr<ThreadPool>>
|
||||
ThreadPools::thread_pool_map;
|
||||
std::map<ThreadPoolPriority, std::string> ThreadPools::name_map;
|
||||
std::shared_mutex ThreadPools::mutex_;
|
||||
|
||||
void
|
||||
@ -50,7 +50,7 @@ ThreadPools::GetThreadPool(milvus::ThreadPoolPriority priority) {
|
||||
coefficient = LOW_PRIORITY_THREAD_CORE_COEFFICIENT;
|
||||
break;
|
||||
}
|
||||
std::string name = name_map[priority];
|
||||
std::string name = name_map()[priority];
|
||||
auto result = thread_pool_map.emplace(
|
||||
priority, std::make_unique<ThreadPool>(coefficient, name));
|
||||
return *(result.first->second);
|
||||
|
||||
@ -42,15 +42,21 @@ class ThreadPools {
|
||||
|
||||
private:
|
||||
ThreadPools() {
|
||||
name_map[HIGH] = "high_priority_thread_pool";
|
||||
name_map[MIDDLE] = "middle_priority_thread_pool";
|
||||
name_map[LOW] = "low_priority_thread_pool";
|
||||
}
|
||||
void
|
||||
ShutDown();
|
||||
|
||||
static std::map<ThreadPoolPriority, std::string>
|
||||
name_map() {
|
||||
static std::map<ThreadPoolPriority, std::string> name_map = {
|
||||
{HIGH, "HIGH_SEGC_POOL"},
|
||||
{MIDDLE, "MIDD_SEGC_POOL"},
|
||||
{LOW, "LOW_SEGC_POOL"}};
|
||||
return name_map;
|
||||
}
|
||||
|
||||
static std::map<ThreadPoolPriority, std::unique_ptr<ThreadPool>>
|
||||
thread_pool_map;
|
||||
static std::map<ThreadPoolPriority, std::string> name_map;
|
||||
static std::shared_mutex mutex_;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user