mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-11-22 12:46:53 +00:00
remove-me: Introduce the MEILI_MAX_INDEX_SIZE env variable to limit the size of an index
This commit is contained in:
committed by
Clément Renault
parent
03ced42ad3
commit
6e5b42e924
@@ -306,6 +306,18 @@ fn create_or_open_index(
|
|||||||
) -> Result<Index> {
|
) -> Result<Index> {
|
||||||
let options = EnvOpenOptions::new();
|
let options = EnvOpenOptions::new();
|
||||||
let mut options = options.read_txn_without_tls();
|
let mut options = options.read_txn_without_tls();
|
||||||
|
|
||||||
|
let map_size = match std::env::var("MEILI_MAX_INDEX_SIZE") {
|
||||||
|
Ok(max_size) => {
|
||||||
|
let max_size = max_size.parse().unwrap();
|
||||||
|
map_size.min(max_size)
|
||||||
|
}
|
||||||
|
Err(VarError::NotPresent) => map_size,
|
||||||
|
Err(VarError::NotUnicode(e)) => {
|
||||||
|
panic!("Non unicode max index size in `MEILI_MAX_INDEX_SIZE`: {e:?}")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
options.map_size(clamp_to_page_size(map_size));
|
options.map_size(clamp_to_page_size(map_size));
|
||||||
|
|
||||||
// You can find more details about this experimental
|
// You can find more details about this experimental
|
||||||
|
|||||||
Reference in New Issue
Block a user