From 92b55bdc57bc8a112069eac04c8c149c0d1dd170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 29 Oct 2024 10:30:14 +0100 Subject: [PATCH] Remove all the remaining RefBumps --- milli/src/update/new/extract/faceted/extract_facets.rs | 2 +- .../new/extract/searchable/extract_word_docids.rs | 1 + milli/src/update/new/extract/searchable/mod.rs | 8 ++++---- milli/src/update/new/indexer/document_deletion.rs | 10 +++------- milli/src/update/new/indexer/mod.rs | 7 ++----- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/milli/src/update/new/extract/faceted/extract_facets.rs b/milli/src/update/new/extract/faceted/extract_facets.rs index e12c9a6ac..794eb90be 100644 --- a/milli/src/update/new/extract/faceted/extract_facets.rs +++ b/milli/src/update/new/extract/faceted/extract_facets.rs @@ -130,7 +130,7 @@ impl FacetedDocidsExtractor { fn facet_fn_with_options<'extractor>( doc_alloc: &Bump, cached_sorter: &mut CboCachedSorter<'extractor>, - cache_fn: impl Fn(&mut CboCachedSorter<'extractor>, &[u8], u32), + cache_fn: impl Fn(&mut CboCachedSorter<'extractor>, &[u8], u32) -> Result<()>, docid: DocumentId, fid: FieldId, value: &Value, diff --git a/milli/src/update/new/extract/searchable/extract_word_docids.rs b/milli/src/update/new/extract/searchable/extract_word_docids.rs index cc954430d..79602503a 100644 --- a/milli/src/update/new/extract/searchable/extract_word_docids.rs +++ b/milli/src/update/new/extract/searchable/extract_word_docids.rs @@ -239,6 +239,7 @@ pub struct WordDocidsExtractors; impl WordDocidsExtractors { pub fn run_extraction<'pl, 'fid, 'indexer, 'index, DC: DocumentChanges<'pl>>( + grenad_parameters: GrenadParameters, document_changes: &DC, indexing_context: IndexingContext<'fid, 'indexer, 'index>, extractor_allocs: &mut ThreadLocal>, diff --git a/milli/src/update/new/extract/searchable/mod.rs b/milli/src/update/new/extract/searchable/mod.rs index d35069d82..5f5c995b1 100644 --- a/milli/src/update/new/extract/searchable/mod.rs +++ b/milli/src/update/new/extract/searchable/mod.rs @@ -36,7 +36,7 @@ impl<'extractor, EX: SearchableExtractor + Sync> Extractor<'extractor> { type Data = RefCell>; - fn init_data(&self, extractor_alloc: RefBump<'extractor>) -> Result { + fn init_data(&self, extractor_alloc: &'extractor Bump) -> Result { Ok(RefCell::new(CboCachedSorter::new_in(extractor_alloc)?)) } @@ -54,7 +54,7 @@ pub trait SearchableExtractor: Sized + Sync { grenad_parameters: GrenadParameters, document_changes: &DC, indexing_context: IndexingContext<'fid, 'indexer, 'index>, - extractor_allocs: &mut ThreadLocal>>, + extractor_allocs: &mut ThreadLocal>, ) -> Result> { let max_memory = grenad_parameters.max_memory_by_thread(); @@ -132,7 +132,7 @@ pub trait SearchableExtractor: Sized + Sync { } fn extract_document_change( - context: &DocumentChangeContext>>, + context: &DocumentChangeContext>, document_tokenizer: &DocumentTokenizer, document_change: DocumentChange, ) -> Result<()>; @@ -148,7 +148,7 @@ impl DocidsExtractor for T { grenad_parameters: GrenadParameters, document_changes: &DC, indexing_context: IndexingContext<'fid, 'indexer, 'index>, - extractor_allocs: &mut ThreadLocal>>, + extractor_allocs: &mut ThreadLocal>, ) -> Result> { Self::run_extraction( grenad_parameters, diff --git a/milli/src/update/new/indexer/document_deletion.rs b/milli/src/update/new/indexer/document_deletion.rs index c10c052a0..8aafbcdf8 100644 --- a/milli/src/update/new/indexer/document_deletion.rs +++ b/milli/src/update/new/indexer/document_deletion.rs @@ -95,7 +95,7 @@ mod test { fn test_deletions() { struct DeletionWithData<'extractor> { deleted: RefCell< - hashbrown::HashSet>, + hashbrown::HashSet, >, } @@ -106,10 +106,7 @@ mod test { impl<'extractor> Extractor<'extractor> for TrackDeletion<'extractor> { type Data = DeletionWithData<'extractor>; - fn init_data( - &self, - extractor_alloc: raw_collections::alloc::RefBump<'extractor>, - ) -> crate::Result { + fn init_data(&self, extractor_alloc: &'extractor Bump) -> crate::Result { let deleted = RefCell::new(hashbrown::HashSet::new_in(extractor_alloc)); Ok(DeletionWithData { deleted }) } @@ -169,8 +166,7 @@ mod test { println!("deleted by {index}: {:?}", data.deleted.borrow()); } for alloc in extractor_allocs.iter_mut() { - let alloc = &mut alloc.0; - alloc.get_mut().reset(); + alloc.0.reset(); } } } diff --git a/milli/src/update/new/indexer/mod.rs b/milli/src/update/new/indexer/mod.rs index 29ff2685e..8cb874f19 100644 --- a/milli/src/update/new/indexer/mod.rs +++ b/milli/src/update/new/indexer/mod.rs @@ -49,10 +49,7 @@ struct DocumentExtractor<'a> { impl<'a, 'extractor> Extractor<'extractor> for DocumentExtractor<'a> { type Data = FullySend<()>; - fn init_data( - &self, - _extractor_alloc: raw_collections::alloc::RefBump<'extractor>, - ) -> Result { + fn init_data(&self, _extractor_alloc: &'extractor Bump) -> Result { Ok(FullySend(())) } @@ -362,7 +359,7 @@ fn extract_and_send_docids< grenad_parameters: GrenadParameters, document_changes: &DC, indexing_context: IndexingContext<'fid, 'indexer, 'index>, - extractor_allocs: &mut ThreadLocal>>, + extractor_allocs: &mut ThreadLocal>, sender: &ExtractorSender, ) -> Result<()> { let merger =