Use separate threadpool for replication state.

This commit is contained in:
Kishore Nallan 2023-01-25 13:22:46 +05:30
parent 21f1937138
commit f038e99809

View File

@ -409,6 +409,7 @@ int run_server(const Config & config, const std::string & version, void (*master
LOG(INFO) << "Thread pool size: " << num_threads;
ThreadPool app_thread_pool(num_threads);
ThreadPool server_thread_pool(num_threads);
ThreadPool replication_thread_pool(num_threads);
// primary DB used for storing the documents: we will not use WAL since Raft provides that
Store store(db_dir);
@ -457,14 +458,14 @@ int run_server(const Config & config, const std::string & version, void (*master
// first we start the peering service
ReplicationState replication_state(server, batch_indexer, &store,
&app_thread_pool, server->get_message_dispatcher(),
&replication_thread_pool, server->get_message_dispatcher(),
ssl_enabled,
&config,
num_collections_parallel_load,
config.get_num_documents_parallel_load());
std::thread raft_thread([&replication_state, &config, &state_dir,
&app_thread_pool, &server_thread_pool, batch_indexer]() {
&app_thread_pool, &server_thread_pool, &replication_thread_pool, batch_indexer]() {
std::thread batch_indexing_thread([batch_indexer]() {
batch_indexer->run();
@ -493,6 +494,10 @@ int run_server(const Config & config, const std::string & version, void (*master
app_thread_pool.shutdown();
LOG(INFO) << "Shutting down replication_thread_pool.";
replication_thread_pool.shutdown();
server->stop();
});