mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
Create temp threadpool with all CPUs in dump
This commit is contained in:
parent
9fd9fcb03e
commit
648b2876f6
6 changed files with 40 additions and 11 deletions
|
@ -1936,7 +1936,8 @@ pub(crate) mod tests {
|
|||
) -> Result<(), crate::error::Error> {
|
||||
let local_pool;
|
||||
let indexer_config = &self.indexer_config;
|
||||
let pool = match &indexer_config.thread_pool {
|
||||
let pool_guard = indexer_config.thread_pool.read().unwrap();
|
||||
let pool = match &*pool_guard {
|
||||
Some(pool) => pool,
|
||||
None => {
|
||||
local_pool = ThreadPoolNoAbortBuilder::new().build().unwrap();
|
||||
|
@ -2030,7 +2031,8 @@ pub(crate) mod tests {
|
|||
) -> Result<(), crate::error::Error> {
|
||||
let local_pool;
|
||||
let indexer_config = &self.indexer_config;
|
||||
let pool = match &indexer_config.thread_pool {
|
||||
let pool_guard = indexer_config.thread_pool.read().unwrap();
|
||||
let pool = match &*pool_guard {
|
||||
Some(pool) => pool,
|
||||
None => {
|
||||
local_pool = ThreadPoolNoAbortBuilder::new().build().unwrap();
|
||||
|
@ -2109,7 +2111,8 @@ pub(crate) mod tests {
|
|||
|
||||
let local_pool;
|
||||
let indexer_config = &index.indexer_config;
|
||||
let pool = match &indexer_config.thread_pool {
|
||||
let pool_guard = indexer_config.thread_pool.read().unwrap();
|
||||
let pool = match &*pool_guard {
|
||||
Some(pool) => pool,
|
||||
None => {
|
||||
local_pool = ThreadPoolNoAbortBuilder::new().build().unwrap();
|
||||
|
|
|
@ -228,8 +228,10 @@ where
|
|||
let possible_embedding_mistakes =
|
||||
crate::vector::error::PossibleEmbeddingMistakes::new(&field_distribution);
|
||||
|
||||
let pool_guard = self.indexer_config.thread_pool.read().unwrap();
|
||||
|
||||
let backup_pool;
|
||||
let pool = match self.indexer_config.thread_pool {
|
||||
let pool = match &*pool_guard {
|
||||
Some(ref pool) => pool,
|
||||
None => {
|
||||
// We initialize a backup pool with the default
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use std::sync::RwLock;
|
||||
|
||||
use grenad::CompressionType;
|
||||
|
||||
use super::GrenadParameters;
|
||||
|
@ -11,7 +13,7 @@ pub struct IndexerConfig {
|
|||
pub max_memory: Option<usize>,
|
||||
pub chunk_compression_type: CompressionType,
|
||||
pub chunk_compression_level: Option<u32>,
|
||||
pub thread_pool: Option<ThreadPoolNoAbort>,
|
||||
pub thread_pool: RwLock<Option<ThreadPoolNoAbort>>,
|
||||
pub max_positions_per_attributes: Option<u32>,
|
||||
pub skip_index_budget: bool,
|
||||
}
|
||||
|
@ -36,7 +38,7 @@ impl Default for IndexerConfig {
|
|||
max_memory: None,
|
||||
chunk_compression_type: CompressionType::None,
|
||||
chunk_compression_level: None,
|
||||
thread_pool: None,
|
||||
thread_pool: RwLock::new(None),
|
||||
max_positions_per_attributes: None,
|
||||
skip_index_budget: false,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue