mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-06 04:36:32 +00:00
Fix tests and format
This commit is contained in:
@ -57,6 +57,7 @@ pub struct V6Reader {
|
|||||||
instance_uid: Option<Uuid>,
|
instance_uid: Option<Uuid>,
|
||||||
metadata: Metadata,
|
metadata: Metadata,
|
||||||
tasks: BufReader<File>,
|
tasks: BufReader<File>,
|
||||||
|
tasks2: BufReader<File>,
|
||||||
batches: Option<BufReader<File>>,
|
batches: Option<BufReader<File>>,
|
||||||
keys: BufReader<File>,
|
keys: BufReader<File>,
|
||||||
features: Option<RuntimeTogglableFeatures>,
|
features: Option<RuntimeTogglableFeatures>,
|
||||||
@ -123,6 +124,7 @@ impl V6Reader {
|
|||||||
metadata: serde_json::from_reader(&*meta_file)?,
|
metadata: serde_json::from_reader(&*meta_file)?,
|
||||||
instance_uid,
|
instance_uid,
|
||||||
tasks: BufReader::new(File::open(dump.path().join("tasks").join("queue.jsonl"))?),
|
tasks: BufReader::new(File::open(dump.path().join("tasks").join("queue.jsonl"))?),
|
||||||
|
tasks2: BufReader::new(File::open(dump.path().join("tasks").join("queue.jsonl"))?),
|
||||||
batches,
|
batches,
|
||||||
keys: BufReader::new(File::open(dump.path().join("keys.jsonl"))?),
|
keys: BufReader::new(File::open(dump.path().join("keys.jsonl"))?),
|
||||||
features,
|
features,
|
||||||
@ -188,11 +190,22 @@ impl V6Reader {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn tasks2(&mut self) -> Box<dyn Iterator<Item = Result<Task>> + '_> {
|
||||||
|
Box::new(
|
||||||
|
(&mut self.tasks2)
|
||||||
|
.lines()
|
||||||
|
.map(|line| -> Result<_> { Ok(serde_json::from_str(&line?)?) }),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn batches(&mut self) -> Box<dyn Iterator<Item = Result<Batch>> + '_> {
|
pub fn batches(&mut self) -> Box<dyn Iterator<Item = Result<Batch>> + '_> {
|
||||||
|
// Get batches but filters batches so that those whose tasks have been deleted are not returned
|
||||||
|
// This is due to bug #5827 that caused them not to be deleted before version 1.18
|
||||||
|
|
||||||
let mut task_uids = RoaringBitmap::new();
|
let mut task_uids = RoaringBitmap::new();
|
||||||
let mut faulty = false;
|
let mut faulty = false;
|
||||||
for task in self.tasks() {
|
for task in self.tasks2() {
|
||||||
let Ok((task, _)) = task else {
|
let Ok(task) = task else {
|
||||||
// If we can't read the tasks, just give up trying to filter the batches
|
// If we can't read the tasks, just give up trying to filter the batches
|
||||||
// The database may contain phantom batches, but that's not that big of a deal
|
// The database may contain phantom batches, but that's not that big of a deal
|
||||||
faulty = true;
|
faulty = true;
|
||||||
|
Reference in New Issue
Block a user