From 34c67ac389de3fcaeb82e6d15190ed85a424eea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 28 Nov 2023 14:31:23 +0100 Subject: [PATCH] Remove the possibility to fail fetching the env info --- index-scheduler/src/index_mapper/index_map.rs | 7 ++----- milli/src/index.rs | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/index-scheduler/src/index_mapper/index_map.rs b/index-scheduler/src/index_mapper/index_map.rs index d250ba02a..f8080d23b 100644 --- a/index-scheduler/src/index_mapper/index_map.rs +++ b/index-scheduler/src/index_mapper/index_map.rs @@ -1,6 +1,3 @@ -/// the map size to use when we don't succeed in reading it in indexes. -const DEFAULT_MAP_SIZE: usize = 10 * 1024 * 1024 * 1024; // 10 GiB - use std::collections::BTreeMap; use std::path::Path; use std::time::Duration; @@ -235,7 +232,7 @@ impl IndexMap { enable_mdb_writemap: bool, map_size_growth: usize, ) { - let map_size = index.map_size().unwrap_or(DEFAULT_MAP_SIZE) + map_size_growth; + let map_size = index.map_size() + map_size_growth; let closing_event = index.prepare_for_closing(); let generation = self.next_generation(); self.unavailable.insert( @@ -387,7 +384,7 @@ mod tests { fn assert_index_size(index: Index, expected: usize) { let expected = clamp_to_page_size(expected); - let index_map_size = index.map_size().unwrap(); + let index_map_size = index.map_size(); assert_eq!(index_map_size, expected); } } diff --git a/milli/src/index.rs b/milli/src/index.rs index 4b15820f6..bd4e5ec2f 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -308,8 +308,8 @@ impl Index { /// /// This value is the maximum between the map size passed during the opening of the index /// and the on-disk size of the index at the time of opening. - pub fn map_size(&self) -> Result { - Ok(self.env.info().map_size) // TODO remove Result + pub fn map_size(&self) -> usize { + self.env.info().map_size } pub fn copy_to_path>(&self, path: P, option: CompactionOption) -> Result {