From 06fa22203b49e3d10c2384fdb390e08419873b7b Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 19 Jan 2023 10:14:21 +0100 Subject: [PATCH] Fix TODO --- index-scheduler/src/index_mapper.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index-scheduler/src/index_mapper.rs b/index-scheduler/src/index_mapper.rs index a92b795ea..edd6d0596 100644 --- a/index-scheduler/src/index_mapper.rs +++ b/index-scheduler/src/index_mapper.rs @@ -61,6 +61,9 @@ pub struct IndexMapper { } mod index_map { + /// the map size to use when we don't succeed in reading it in indexes. + const DEFAULT_MAP_SIZE: usize = 10_737_418_240; // 10 GiB + use std::collections::BTreeMap; use std::path::Path; use std::time::Duration; @@ -259,8 +262,7 @@ mod index_map { } fn close(&mut self, uuid: Uuid, index: Index, map_size_growth: usize) { - /// TODO: default map_size - let map_size = index.map_size().unwrap_or_default() + map_size_growth; + let map_size = index.map_size().unwrap_or(DEFAULT_MAP_SIZE) + map_size_growth; let closing_event = index.prepare_for_closing(); let generation = self.next_generation(); self.unavailable