From 502579646f9208699e272bc0f5d5a59048cc9771 Mon Sep 17 00:00:00 2001 From: zhangshixiang Date: Mon, 6 Mar 2023 15:52:22 +0800 Subject: [PATCH] raft part use separate thread pool --- src/kvstore/NebulaStore.cpp | 14 ++++++++++---- src/kvstore/NebulaStore.h | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/kvstore/NebulaStore.cpp b/src/kvstore/NebulaStore.cpp index c49c9d9893a..d2a830b3d9b 100644 --- a/src/kvstore/NebulaStore.cpp +++ b/src/kvstore/NebulaStore.cpp @@ -60,7 +60,7 @@ bool NebulaStore::init() { FLAGS_raft_num_worker_threads); pool->setNamePrefix("part-executor"); pool->start(); - workers_ = std::move(pool); + partExecutor_ = std::move(pool); } snapshot_.reset(new NebulaSnapshotManager(this)); raftService_ = raftex::RaftexService::createService(ioPool_, workers_, raftAddr_.port); @@ -473,7 +473,7 @@ std::shared_ptr NebulaStore::newPart(GraphSpaceID spaceId, engine, ioPool_, bgWorkers_, - workers_, + partExecutor_, snapshot_, clientMan_, diskMan_, @@ -632,8 +632,14 @@ std::shared_ptr NebulaStore::newListener(GraphSpaceID spaceId, folly::stringPrintf("%s/%d/%d/wal", options_.listenerPath_.c_str(), spaceId, partId); std::shared_ptr listener; if (type == meta::cpp2::ListenerType::ELASTICSEARCH) { - listener = std::make_shared( - spaceId, partId, raftAddr_, walPath, ioPool_, bgWorkers_, workers_, options_.schemaMan_); + listener = std::make_shared(spaceId, + partId, + raftAddr_, + walPath, + ioPool_, + bgWorkers_, + partExecutor_, + options_.schemaMan_); } else { LOG(FATAL) << "Should not reach here"; return nullptr; diff --git a/src/kvstore/NebulaStore.h b/src/kvstore/NebulaStore.h index 85972da2191..224f7e7d052 100644 --- a/src/kvstore/NebulaStore.h +++ b/src/kvstore/NebulaStore.h @@ -69,9 +69,10 @@ class NebulaStore : public KVStore, public Handler { NebulaStore(KVOptions options, std::shared_ptr ioPool, HostAddr serviceAddr, - std::shared_ptr) + std::shared_ptr workers) : ioPool_(ioPool), storeSvcAddr_(serviceAddr), + workers_(workers), raftAddr_(getRaftAddr(serviceAddr)), options_(std::move(options)) { CHECK_NOTNULL(options_.partMan_); @@ -866,6 +867,7 @@ class NebulaStore : public KVStore, public Handler { std::shared_ptr bgWorkers_; HostAddr storeSvcAddr_; std::shared_ptr workers_; + std::shared_ptr partExecutor_; HostAddr raftAddr_; KVOptions options_;