Remove all the remaining RefBumps

This commit is contained in:
Clément Renault 2024-10-29 10:30:14 +01:00
parent fdfad0c3c1
commit 92b55bdc57
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
5 changed files with 11 additions and 17 deletions

View File

@ -130,7 +130,7 @@ impl FacetedDocidsExtractor {
fn facet_fn_with_options<'extractor>( fn facet_fn_with_options<'extractor>(
doc_alloc: &Bump, doc_alloc: &Bump,
cached_sorter: &mut CboCachedSorter<'extractor>, 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, docid: DocumentId,
fid: FieldId, fid: FieldId,
value: &Value, value: &Value,

View File

@ -239,6 +239,7 @@ pub struct WordDocidsExtractors;
impl WordDocidsExtractors { impl WordDocidsExtractors {
pub fn run_extraction<'pl, 'fid, 'indexer, 'index, DC: DocumentChanges<'pl>>( pub fn run_extraction<'pl, 'fid, 'indexer, 'index, DC: DocumentChanges<'pl>>(
grenad_parameters: GrenadParameters,
document_changes: &DC, document_changes: &DC,
indexing_context: IndexingContext<'fid, 'indexer, 'index>, indexing_context: IndexingContext<'fid, 'indexer, 'index>,
extractor_allocs: &mut ThreadLocal<FullySend<Bump>>, extractor_allocs: &mut ThreadLocal<FullySend<Bump>>,

View File

@ -36,7 +36,7 @@ impl<'extractor, EX: SearchableExtractor + Sync> Extractor<'extractor>
{ {
type Data = RefCell<CboCachedSorter<'extractor>>; type Data = RefCell<CboCachedSorter<'extractor>>;
fn init_data(&self, extractor_alloc: RefBump<'extractor>) -> Result<Self::Data> { fn init_data(&self, extractor_alloc: &'extractor Bump) -> Result<Self::Data> {
Ok(RefCell::new(CboCachedSorter::new_in(extractor_alloc)?)) Ok(RefCell::new(CboCachedSorter::new_in(extractor_alloc)?))
} }
@ -54,7 +54,7 @@ pub trait SearchableExtractor: Sized + Sync {
grenad_parameters: GrenadParameters, grenad_parameters: GrenadParameters,
document_changes: &DC, document_changes: &DC,
indexing_context: IndexingContext<'fid, 'indexer, 'index>, indexing_context: IndexingContext<'fid, 'indexer, 'index>,
extractor_allocs: &mut ThreadLocal<FullySend<RefCell<Bump>>>, extractor_allocs: &mut ThreadLocal<FullySend<Bump>>,
) -> Result<Merger<File, MergeDeladdCboRoaringBitmaps>> { ) -> Result<Merger<File, MergeDeladdCboRoaringBitmaps>> {
let max_memory = grenad_parameters.max_memory_by_thread(); let max_memory = grenad_parameters.max_memory_by_thread();
@ -132,7 +132,7 @@ pub trait SearchableExtractor: Sized + Sync {
} }
fn extract_document_change( fn extract_document_change(
context: &DocumentChangeContext<RefCell<CboCachedSorter<MergeDeladdCboRoaringBitmaps>>>, context: &DocumentChangeContext<RefCell<CboCachedSorter>>,
document_tokenizer: &DocumentTokenizer, document_tokenizer: &DocumentTokenizer,
document_change: DocumentChange, document_change: DocumentChange,
) -> Result<()>; ) -> Result<()>;
@ -148,7 +148,7 @@ impl<T: SearchableExtractor> DocidsExtractor for T {
grenad_parameters: GrenadParameters, grenad_parameters: GrenadParameters,
document_changes: &DC, document_changes: &DC,
indexing_context: IndexingContext<'fid, 'indexer, 'index>, indexing_context: IndexingContext<'fid, 'indexer, 'index>,
extractor_allocs: &mut ThreadLocal<FullySend<RefCell<Bump>>>, extractor_allocs: &mut ThreadLocal<FullySend<Bump>>,
) -> Result<Merger<File, MergeDeladdCboRoaringBitmaps>> { ) -> Result<Merger<File, MergeDeladdCboRoaringBitmaps>> {
Self::run_extraction( Self::run_extraction(
grenad_parameters, grenad_parameters,

View File

@ -95,7 +95,7 @@ mod test {
fn test_deletions() { fn test_deletions() {
struct DeletionWithData<'extractor> { struct DeletionWithData<'extractor> {
deleted: RefCell< deleted: RefCell<
hashbrown::HashSet<DocumentId, hashbrown::DefaultHashBuilder, RefBump<'extractor>>, hashbrown::HashSet<DocumentId, hashbrown::DefaultHashBuilder, &'extractor Bump>,
>, >,
} }
@ -106,10 +106,7 @@ mod test {
impl<'extractor> Extractor<'extractor> for TrackDeletion<'extractor> { impl<'extractor> Extractor<'extractor> for TrackDeletion<'extractor> {
type Data = DeletionWithData<'extractor>; type Data = DeletionWithData<'extractor>;
fn init_data( fn init_data(&self, extractor_alloc: &'extractor Bump) -> crate::Result<Self::Data> {
&self,
extractor_alloc: raw_collections::alloc::RefBump<'extractor>,
) -> crate::Result<Self::Data> {
let deleted = RefCell::new(hashbrown::HashSet::new_in(extractor_alloc)); let deleted = RefCell::new(hashbrown::HashSet::new_in(extractor_alloc));
Ok(DeletionWithData { deleted }) Ok(DeletionWithData { deleted })
} }
@ -169,8 +166,7 @@ mod test {
println!("deleted by {index}: {:?}", data.deleted.borrow()); println!("deleted by {index}: {:?}", data.deleted.borrow());
} }
for alloc in extractor_allocs.iter_mut() { for alloc in extractor_allocs.iter_mut() {
let alloc = &mut alloc.0; alloc.0.reset();
alloc.get_mut().reset();
} }
} }
} }

View File

@ -49,10 +49,7 @@ struct DocumentExtractor<'a> {
impl<'a, 'extractor> Extractor<'extractor> for DocumentExtractor<'a> { impl<'a, 'extractor> Extractor<'extractor> for DocumentExtractor<'a> {
type Data = FullySend<()>; type Data = FullySend<()>;
fn init_data( fn init_data(&self, _extractor_alloc: &'extractor Bump) -> Result<Self::Data> {
&self,
_extractor_alloc: raw_collections::alloc::RefBump<'extractor>,
) -> Result<Self::Data> {
Ok(FullySend(())) Ok(FullySend(()))
} }
@ -362,7 +359,7 @@ fn extract_and_send_docids<
grenad_parameters: GrenadParameters, grenad_parameters: GrenadParameters,
document_changes: &DC, document_changes: &DC,
indexing_context: IndexingContext<'fid, 'indexer, 'index>, indexing_context: IndexingContext<'fid, 'indexer, 'index>,
extractor_allocs: &mut ThreadLocal<FullySend<RefCell<Bump>>>, extractor_allocs: &mut ThreadLocal<FullySend<Bump>>,
sender: &ExtractorSender, sender: &ExtractorSender,
) -> Result<()> { ) -> Result<()> {
let merger = let merger =