mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-12-22 04:16:59 +00:00
Compute total moved docs with a variable rather than a vec
This commit is contained in:
@@ -153,9 +153,11 @@ impl IndexScheduler {
|
|||||||
return Ok(0);
|
return Ok(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let moved_documents: Vec<u64> = self.index_mapper.try_for_each_index(
|
let mut total_moved_documents = 0;
|
||||||
|
|
||||||
|
self.index_mapper.try_for_each_index::<(), ()>(
|
||||||
&scheduler_rtxn,
|
&scheduler_rtxn,
|
||||||
|index_uid, index| -> crate::Result<u64> {
|
|index_uid, index| -> crate::Result<()> {
|
||||||
indexer_alloc.reset();
|
indexer_alloc.reset();
|
||||||
let err = |err| Error::from_milli(err, Some(index_uid.to_string()));
|
let err = |err| Error::from_milli(err, Some(index_uid.to_string()));
|
||||||
let index_rtxn = index.read_txn()?;
|
let index_rtxn = index.read_txn()?;
|
||||||
@@ -219,10 +221,10 @@ impl IndexScheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if documents_to_delete.is_empty() {
|
if documents_to_delete.is_empty() {
|
||||||
return Ok(0);
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let moved_count = documents_to_delete.len();
|
total_moved_documents += documents_to_delete.len();
|
||||||
|
|
||||||
let mut new_fields_ids_map = fields_ids_map.clone();
|
let mut new_fields_ids_map = fields_ids_map.clone();
|
||||||
|
|
||||||
@@ -273,12 +275,10 @@ impl IndexScheduler {
|
|||||||
// update stats after committing changes to index
|
// update stats after committing changes to index
|
||||||
mapper_wtxn.commit()?;
|
mapper_wtxn.commit()?;
|
||||||
|
|
||||||
Ok(moved_count)
|
Ok(())
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let moved_documents: u64 = moved_documents.into_iter().sum();
|
Ok(total_moved_documents)
|
||||||
|
|
||||||
Ok(moved_documents)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user