mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
Always sort internal Sorter entries in parallel
This commit is contained in:
parent
b10c060bf7
commit
4d864f0702
@ -47,6 +47,7 @@ pub fn create_sorter(
|
|||||||
builder.allow_realloc(false);
|
builder.allow_realloc(false);
|
||||||
}
|
}
|
||||||
builder.sort_algorithm(sort_algorithm);
|
builder.sort_algorithm(sort_algorithm);
|
||||||
|
builder.sort_in_parallel(true);
|
||||||
builder.build()
|
builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,43 +114,24 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// We initialize the sorter with the user indexing settings.
|
// We initialize the sorter with the user indexing settings.
|
||||||
let original_sorter = {
|
let original_sorter = create_sorter(
|
||||||
let mut builder = grenad::Sorter::builder(merge_function);
|
grenad::SortAlgorithm::Stable,
|
||||||
builder.chunk_compression_type(indexer_settings.chunk_compression_type);
|
merge_function,
|
||||||
if let Some(level) = indexer_settings.chunk_compression_level {
|
indexer_settings.chunk_compression_type,
|
||||||
builder.chunk_compression_level(level);
|
indexer_settings.chunk_compression_level,
|
||||||
}
|
indexer_settings.max_nb_chunks,
|
||||||
if let Some(nb_chunks) = indexer_settings.max_nb_chunks {
|
indexer_settings.max_memory.map(|mem| mem / 2),
|
||||||
builder.max_nb_chunks(nb_chunks);
|
);
|
||||||
}
|
|
||||||
if let Some(memory) = indexer_settings.max_memory.map(|mem| mem / 2) {
|
|
||||||
builder.dump_threshold(memory);
|
|
||||||
builder.allow_realloc(false);
|
|
||||||
}
|
|
||||||
builder.sort_algorithm(grenad::SortAlgorithm::Stable);
|
|
||||||
builder.sort_in_parallel(true);
|
|
||||||
builder.build()
|
|
||||||
};
|
|
||||||
|
|
||||||
// We initialize the sorter with the user indexing settings.
|
// We initialize the sorter with the user indexing settings.
|
||||||
let flattened_sorter = {
|
let flattened_sorter = create_sorter(
|
||||||
let mut builder = grenad::Sorter::builder(merge_function);
|
grenad::SortAlgorithm::Stable,
|
||||||
builder.chunk_compression_type(indexer_settings.chunk_compression_type);
|
merge_function,
|
||||||
if let Some(level) = indexer_settings.chunk_compression_level {
|
indexer_settings.chunk_compression_type,
|
||||||
builder.chunk_compression_level(level);
|
indexer_settings.chunk_compression_level,
|
||||||
}
|
indexer_settings.max_nb_chunks,
|
||||||
if let Some(nb_chunks) = indexer_settings.max_nb_chunks {
|
indexer_settings.max_memory.map(|mem| mem / 2),
|
||||||
builder.max_nb_chunks(nb_chunks);
|
);
|
||||||
}
|
|
||||||
if let Some(memory) = indexer_settings.max_memory.map(|mem| mem / 2) {
|
|
||||||
builder.dump_threshold(memory);
|
|
||||||
builder.allow_realloc(false);
|
|
||||||
}
|
|
||||||
builder.sort_algorithm(grenad::SortAlgorithm::Stable);
|
|
||||||
builder.sort_in_parallel(true);
|
|
||||||
builder.build()
|
|
||||||
};
|
|
||||||
|
|
||||||
let documents_ids = index.documents_ids(wtxn)?;
|
let documents_ids = index.documents_ids(wtxn)?;
|
||||||
|
|
||||||
Ok(Transform {
|
Ok(Transform {
|
||||||
|
Loading…
Reference in New Issue
Block a user