Skip to content

Commit

Permalink
raft part use separate thread pool
Browse files Browse the repository at this point in the history
  • Loading branch information
tangyuanzhang committed Mar 6, 2023
1 parent 7a316a8 commit 5025796
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/kvstore/NebulaStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -473,7 +473,7 @@ std::shared_ptr<Part> NebulaStore::newPart(GraphSpaceID spaceId,
engine,
ioPool_,
bgWorkers_,
workers_,
partExecutor_,
snapshot_,
clientMan_,
diskMan_,
Expand Down Expand Up @@ -632,8 +632,14 @@ std::shared_ptr<Listener> NebulaStore::newListener(GraphSpaceID spaceId,
folly::stringPrintf("%s/%d/%d/wal", options_.listenerPath_.c_str(), spaceId, partId);
std::shared_ptr<Listener> listener;
if (type == meta::cpp2::ListenerType::ELASTICSEARCH) {
listener = std::make_shared<ESListener>(
spaceId, partId, raftAddr_, walPath, ioPool_, bgWorkers_, workers_, options_.schemaMan_);
listener = std::make_shared<ESListener>(spaceId,
partId,
raftAddr_,
walPath,
ioPool_,
bgWorkers_,
partExecutor_,
options_.schemaMan_);
} else {
LOG(FATAL) << "Should not reach here";
return nullptr;
Expand Down
4 changes: 3 additions & 1 deletion src/kvstore/NebulaStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ class NebulaStore : public KVStore, public Handler {
NebulaStore(KVOptions options,
std::shared_ptr<folly::IOThreadPoolExecutor> ioPool,
HostAddr serviceAddr,
std::shared_ptr<folly::Executor>)
std::shared_ptr<folly::Executor> workers)
: ioPool_(ioPool),
storeSvcAddr_(serviceAddr),
workers_(workers),
raftAddr_(getRaftAddr(serviceAddr)),
options_(std::move(options)) {
CHECK_NOTNULL(options_.partMan_);
Expand Down Expand Up @@ -866,6 +867,7 @@ class NebulaStore : public KVStore, public Handler {
std::shared_ptr<thread::GenericThreadPool> bgWorkers_;
HostAddr storeSvcAddr_;
std::shared_ptr<folly::Executor> workers_;
std::shared_ptr<folly::Executor> partExecutor_;
HostAddr raftAddr_;
KVOptions options_;

Expand Down

0 comments on commit 5025796

Please sign in to comment.