mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-10-30 01:38:49 +01:00
Call spill_if_needed in for_each_document_change
This commit is contained in:
parent
336c2816e3
commit
f095477c0c
@ -308,7 +308,7 @@ impl<
|
||||
db_fields_ids_map,
|
||||
new_fields_ids_map: fields_ids_map,
|
||||
doc_alloc,
|
||||
extractor_alloc,
|
||||
extractor_alloc: &extractor_alloc.0,
|
||||
data,
|
||||
doc_allocs,
|
||||
})
|
||||
@ -327,6 +327,15 @@ pub trait Extractor<'extractor>: Sync {
|
||||
context: &'doc DocumentChangeContext<Self::Data>,
|
||||
) -> Result<()>;
|
||||
|
||||
/// Gives a chance to the data to spill itself on disk and reset the extractor allocator.
|
||||
///
|
||||
/// The Extractor and data implementations are responsible for checking that there are no live allocations before
|
||||
/// attempting to reset the extractor allocator. Failure to uphold this invariant will result in a panic.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// - calls `extractor_alloc.borrow_mut()` while there are outstanding allocations referencing the `extractor_alloc`
|
||||
#[inline]
|
||||
fn spill_if_needed<'doc>(
|
||||
&'doc self,
|
||||
_data: &'doc Self::Data,
|
||||
@ -423,6 +432,8 @@ where
|
||||
// send back the doc_alloc in the pool
|
||||
context.doc_allocs.get_or_default().0.set(std::mem::take(&mut context.doc_alloc));
|
||||
|
||||
extractor.spill_if_needed(&context.data, &context.extractor_alloc);
|
||||
|
||||
res
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user