mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Fix(cli): Clamp databases max size to a multiple of system page size
fix #2659
This commit is contained in:
parent
dfbdc565f9
commit
cf955a77db
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2125,6 +2125,7 @@ dependencies = [
|
|||||||
"num_cpus",
|
"num_cpus",
|
||||||
"obkv",
|
"obkv",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"page_size",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"paste",
|
"paste",
|
||||||
"permissive-json-pointer",
|
"permissive-json-pointer",
|
||||||
|
@ -33,6 +33,7 @@ mime = "0.3.16"
|
|||||||
num_cpus = "1.13.1"
|
num_cpus = "1.13.1"
|
||||||
obkv = "0.2.0"
|
obkv = "0.2.0"
|
||||||
once_cell = "1.10.0"
|
once_cell = "1.10.0"
|
||||||
|
page_size = "0.4.2"
|
||||||
parking_lot = "0.12.0"
|
parking_lot = "0.12.0"
|
||||||
permissive-json-pointer = { path = "../permissive-json-pointer" }
|
permissive-json-pointer = { path = "../permissive-json-pointer" }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
@ -275,11 +275,13 @@ impl IndexControllerBuilder {
|
|||||||
|
|
||||||
/// Set the index controller builder's max update store size.
|
/// Set the index controller builder's max update store size.
|
||||||
pub fn set_max_task_store_size(&mut self, max_update_store_size: usize) -> &mut Self {
|
pub fn set_max_task_store_size(&mut self, max_update_store_size: usize) -> &mut Self {
|
||||||
|
let max_update_store_size = clamp_to_page_size(max_update_store_size);
|
||||||
self.max_task_store_size.replace(max_update_store_size);
|
self.max_task_store_size.replace(max_update_store_size);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_max_index_size(&mut self, size: usize) -> &mut Self {
|
pub fn set_max_index_size(&mut self, size: usize) -> &mut Self {
|
||||||
|
let size = clamp_to_page_size(size);
|
||||||
self.max_index_size.replace(size);
|
self.max_index_size.replace(size);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -645,6 +647,11 @@ pub async fn get_arc_ownership_blocking<T>(mut item: Arc<T>) -> T {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clamp the provided value to be a multiple of system page size.
|
||||||
|
fn clamp_to_page_size(size: usize) -> usize {
|
||||||
|
size / page_size::get() * page_size::get()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use futures::future::ok;
|
use futures::future::ok;
|
||||||
|
Loading…
Reference in New Issue
Block a user