mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Use more complete snapshot tests for the index scheduler
This commit is contained in:
parent
4c55c30027
commit
13a72f8757
@ -58,6 +58,16 @@ impl FileStore {
|
|||||||
|
|
||||||
Ok((uuid, update_file))
|
Ok((uuid, update_file))
|
||||||
}
|
}
|
||||||
|
/// Creates a new temporary update file with the given Uuid.
|
||||||
|
/// A call to `persist` is needed to persist the file in the database.
|
||||||
|
pub fn new_update_woth_uuid(&self, uuid: u128) -> Result<(Uuid, File)> {
|
||||||
|
let file = NamedTempFile::new_in(&self.path)?;
|
||||||
|
let uuid = Uuid::from_u128(uuid);
|
||||||
|
let path = self.path.join(uuid.to_string());
|
||||||
|
let update_file = File { file, path };
|
||||||
|
|
||||||
|
Ok((uuid, update_file))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the file corresponding to the requested uuid.
|
/// Returns the file corresponding to the requested uuid.
|
||||||
pub fn get_update(&self, uuid: Uuid) -> Result<StdFile> {
|
pub fn get_update(&self, uuid: Uuid) -> Result<StdFile> {
|
||||||
|
@ -364,6 +364,10 @@ impl IndexScheduler {
|
|||||||
pub fn create_update_file(&self) -> Result<(Uuid, File)> {
|
pub fn create_update_file(&self) -> Result<(Uuid, File)> {
|
||||||
Ok(self.file_store.new_update()?)
|
Ok(self.file_store.new_update()?)
|
||||||
}
|
}
|
||||||
|
#[cfg(test)]
|
||||||
|
pub fn create_update_file_with_uuid(&self, uuid: u128) -> Result<(Uuid, File)> {
|
||||||
|
Ok(self.file_store.new_update_woth_uuid(uuid)?)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn delete_update_file(&self, uuid: Uuid) -> Result<()> {
|
pub fn delete_update_file(&self, uuid: Uuid) -> Result<()> {
|
||||||
Ok(self.file_store.delete(uuid)?)
|
Ok(self.file_store.delete(uuid)?)
|
||||||
@ -404,26 +408,20 @@ impl IndexScheduler {
|
|||||||
|
|
||||||
// 2. Process the tasks
|
// 2. Process the tasks
|
||||||
let res = self.process_batch(batch);
|
let res = self.process_batch(batch);
|
||||||
dbg!();
|
|
||||||
let mut wtxn = self.env.write_txn()?;
|
let mut wtxn = self.env.write_txn()?;
|
||||||
dbg!();
|
|
||||||
let finished_at = OffsetDateTime::now_utc();
|
let finished_at = OffsetDateTime::now_utc();
|
||||||
match res {
|
match res {
|
||||||
Ok(tasks) => {
|
Ok(tasks) => {
|
||||||
dbg!();
|
|
||||||
for mut task in tasks {
|
for mut task in tasks {
|
||||||
task.started_at = Some(started_at);
|
task.started_at = Some(started_at);
|
||||||
task.finished_at = Some(finished_at);
|
task.finished_at = Some(finished_at);
|
||||||
// TODO the info field should've been set by the process_batch function
|
// TODO the info field should've been set by the process_batch function
|
||||||
self.update_task(&mut wtxn, &task)?;
|
self.update_task(&mut wtxn, &task)?;
|
||||||
task.remove_data()?;
|
task.remove_data()?;
|
||||||
dbg!();
|
|
||||||
}
|
}
|
||||||
dbg!();
|
|
||||||
}
|
}
|
||||||
// In case of a failure we must get back and patch all the tasks with the error.
|
// In case of a failure we must get back and patch all the tasks with the error.
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
dbg!();
|
|
||||||
let error: ResponseError = err.into();
|
let error: ResponseError = err.into();
|
||||||
for id in ids {
|
for id in ids {
|
||||||
let mut task = self.get_task(&wtxn, id)?.ok_or(Error::CorruptedTaskQueue)?;
|
let mut task = self.get_task(&wtxn, id)?.ok_or(Error::CorruptedTaskQueue)?;
|
||||||
@ -437,11 +435,8 @@ impl IndexScheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg!();
|
|
||||||
*self.processing_tasks.write().unwrap() = (finished_at, RoaringBitmap::new());
|
*self.processing_tasks.write().unwrap() = (finished_at, RoaringBitmap::new());
|
||||||
dbg!();
|
|
||||||
wtxn.commit()?;
|
wtxn.commit()?;
|
||||||
dbg!();
|
|
||||||
log::info!("A batch of tasks was successfully completed.");
|
log::info!("A batch of tasks was successfully completed.");
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -461,7 +456,7 @@ mod tests {
|
|||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{assert_smol_debug_snapshot, snapshot::snapshot_index};
|
use crate::{assert_smol_debug_snapshot, snapshot::snapshot_index_scheduler};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@ -517,8 +512,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn register() {
|
fn register() {
|
||||||
let (index_scheduler, handle) = IndexScheduler::test(true);
|
let (index_scheduler, handle) = IndexScheduler::test();
|
||||||
handle.dont_block();
|
|
||||||
|
|
||||||
let kinds = [
|
let kinds = [
|
||||||
KindWithContent::IndexCreation {
|
KindWithContent::IndexCreation {
|
||||||
@ -529,7 +523,7 @@ mod tests {
|
|||||||
index_uid: S("catto"),
|
index_uid: S("catto"),
|
||||||
primary_key: None,
|
primary_key: None,
|
||||||
method: ReplaceDocuments,
|
method: ReplaceDocuments,
|
||||||
content_file: Uuid::new_v4(),
|
content_file: Uuid::from_u128(0),
|
||||||
documents_count: 12,
|
documents_count: 12,
|
||||||
allow_index_creation: true,
|
allow_index_creation: true,
|
||||||
},
|
},
|
||||||
@ -538,7 +532,7 @@ mod tests {
|
|||||||
index_uid: S("catto"),
|
index_uid: S("catto"),
|
||||||
primary_key: None,
|
primary_key: None,
|
||||||
method: ReplaceDocuments,
|
method: ReplaceDocuments,
|
||||||
content_file: Uuid::new_v4(),
|
content_file: Uuid::from_u128(1),
|
||||||
documents_count: 50,
|
documents_count: 50,
|
||||||
allow_index_creation: true,
|
allow_index_creation: true,
|
||||||
},
|
},
|
||||||
@ -546,7 +540,7 @@ mod tests {
|
|||||||
index_uid: S("doggo"),
|
index_uid: S("doggo"),
|
||||||
primary_key: Some(S("bone")),
|
primary_key: Some(S("bone")),
|
||||||
method: ReplaceDocuments,
|
method: ReplaceDocuments,
|
||||||
content_file: Uuid::new_v4(),
|
content_file: Uuid::from_u128(2),
|
||||||
documents_count: 5000,
|
documents_count: 5000,
|
||||||
allow_index_creation: true,
|
allow_index_creation: true,
|
||||||
},
|
},
|
||||||
@ -563,35 +557,7 @@ mod tests {
|
|||||||
inserted_tasks.push(task);
|
inserted_tasks.push(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
let mut all_tasks = Vec::new();
|
|
||||||
for ret in index_scheduler.all_tasks.iter(&rtxn).unwrap() {
|
|
||||||
all_tasks.push(ret.unwrap().0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// we can't assert on the content of the tasks because there is the date and uuid that changes everytime.
|
|
||||||
assert_smol_debug_snapshot!(all_tasks, @"[U32(0), U32(1), U32(2), U32(3), U32(4)]");
|
|
||||||
|
|
||||||
let mut status = Vec::new();
|
|
||||||
for ret in index_scheduler.status.iter(&rtxn).unwrap() {
|
|
||||||
status.push(ret.unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(status, @"[(Enqueued, RoaringBitmap<[0, 1, 2, 3, 4]>)]");
|
|
||||||
|
|
||||||
let mut kind = Vec::new();
|
|
||||||
for ret in index_scheduler.kind.iter(&rtxn).unwrap() {
|
|
||||||
kind.push(ret.unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(kind, @"[(DocumentAddition, RoaringBitmap<[1, 3, 4]>), (IndexCreation, RoaringBitmap<[0]>), (CancelTask, RoaringBitmap<[2]>)]");
|
|
||||||
|
|
||||||
let mut index_tasks = Vec::new();
|
|
||||||
for ret in index_scheduler.index_tasks.iter(&rtxn).unwrap() {
|
|
||||||
index_tasks.push(ret.unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(index_tasks, @r###"[("catto", RoaringBitmap<[0, 1, 3]>), ("doggo", RoaringBitmap<[4]>)]"###);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -608,12 +574,7 @@ mod tests {
|
|||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut tasks = index_scheduler.get_tasks(Query::default()).unwrap();
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
tasks.reverse();
|
|
||||||
assert_eq!(tasks.len(), 3);
|
|
||||||
assert_eq!(tasks[0].status, Status::Processing);
|
|
||||||
assert_eq!(tasks[1].status, Status::Enqueued);
|
|
||||||
assert_eq!(tasks[2].status, Status::Enqueued);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// We send a lot of tasks but notify the tasks scheduler only once as
|
/// We send a lot of tasks but notify the tasks scheduler only once as
|
||||||
@ -720,101 +681,27 @@ mod tests {
|
|||||||
allow_index_creation: true,
|
allow_index_creation: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
for task in to_enqueue {
|
for task in to_enqueue {
|
||||||
let _ = index_scheduler.register(task).unwrap();
|
let _ = index_scheduler.register(task).unwrap();
|
||||||
}
|
}
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
|
||||||
let mut all_tasks = Vec::new();
|
|
||||||
for ret in index_scheduler.all_tasks.iter(&rtxn).unwrap() {
|
|
||||||
all_tasks.push(ret.unwrap().0);
|
|
||||||
}
|
|
||||||
rtxn.commit().unwrap();
|
|
||||||
|
|
||||||
assert_snapshot!(snapshot_index(&index_scheduler), @r###"
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
### Processing Tasks:
|
|
||||||
[]
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
### All Tasks:
|
|
||||||
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
|
||||||
1 {uid: 1, status: enqueued, details: { received_documents: 12, indexed_documents: 0 }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: e881d224-ed39-4322-87ae-eae5a749b835, documents_count: 12, allow_index_creation: true }}
|
|
||||||
2 {uid: 2, status: enqueued, details: { received_documents: 5000, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: f21ce9f3-58f4-4bab-813b-ecb0b202d20f, documents_count: 5000, allow_index_creation: true }}
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
### Status:
|
|
||||||
enqueued [0,1,2,]
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
### Kind:
|
|
||||||
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [1,2,]
|
|
||||||
"indexCreation" [0,]
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
### Index Tasks:
|
|
||||||
catto [0,1,]
|
|
||||||
doggo [2,]
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
### Index Mapper:
|
|
||||||
[]
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
"###);
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(all_tasks, @"[U32(0), U32(1), U32(2)]");
|
|
||||||
|
|
||||||
index_scheduler.register(KindWithContent::DeleteTasks {
|
index_scheduler.register(KindWithContent::DeleteTasks {
|
||||||
query: "test_query".to_owned(),
|
query: "test_query".to_owned(),
|
||||||
tasks: vec![0, 1],
|
tasks: vec![0, 1],
|
||||||
});
|
});
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
let task = index_scheduler
|
|
||||||
.all_tasks
|
|
||||||
.get(&rtxn, &BEU32::new(3))
|
|
||||||
.unwrap()
|
|
||||||
.unwrap();
|
|
||||||
rtxn.commit().unwrap();
|
|
||||||
|
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
|
||||||
let mut all_tasks = Vec::new();
|
|
||||||
for ret in index_scheduler.all_tasks.iter(&rtxn).unwrap() {
|
|
||||||
all_tasks.push(ret.unwrap().0);
|
|
||||||
}
|
|
||||||
rtxn.commit().unwrap();
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(all_tasks, @"[U32(0), U32(1), U32(2), U32(3)]");
|
|
||||||
|
|
||||||
handle.wait_till(Breakpoint::BatchCreated);
|
handle.wait_till(Breakpoint::BatchCreated);
|
||||||
|
|
||||||
// the last task, with uid = 3, should be marked as processing
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
// let processing_tasks = &index_scheduler.processing_tasks.read().unwrap().1;
|
|
||||||
// assert_smol_debug_snapshot!(processing_tasks, @"RoaringBitmap<[3]>");
|
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
|
||||||
let task = index_scheduler
|
|
||||||
.all_tasks
|
|
||||||
.get(&rtxn, &BEU32::new(3))
|
|
||||||
.unwrap()
|
|
||||||
.unwrap();
|
|
||||||
rtxn.commit().unwrap();
|
|
||||||
|
|
||||||
handle.wait_till(Breakpoint::AfterProcessing);
|
handle.wait_till(Breakpoint::AfterProcessing);
|
||||||
|
|
||||||
dbg!();
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
|
|
||||||
let processing_tasks = &index_scheduler.processing_tasks.read().unwrap().1;
|
|
||||||
assert_smol_debug_snapshot!(processing_tasks, @"RoaringBitmap<[]>");
|
|
||||||
|
|
||||||
dbg!();
|
|
||||||
|
|
||||||
let rtxn = index_scheduler.env.read_txn().unwrap();
|
|
||||||
let mut all_tasks = Vec::new();
|
|
||||||
for ret in index_scheduler.all_tasks.iter(&rtxn).unwrap() {
|
|
||||||
all_tasks.push(ret.unwrap().0);
|
|
||||||
}
|
|
||||||
rtxn.commit().unwrap();
|
|
||||||
|
|
||||||
dbg!();
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(all_tasks, @"[U32(0), U32(1), U32(2), U32(3)]");
|
|
||||||
handle.dont_block();
|
handle.dont_block();
|
||||||
// index_scheduler.register(KindWithContent::DocumentClear { index_uid: 0 });
|
|
||||||
// index_scheduler.register(KindWithContent::CancelTask { tasks: vec![0] });
|
|
||||||
// index_scheduler.register(KindWithContendt::DeleteTasks { tasks: vec![0] });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -827,7 +714,7 @@ mod tests {
|
|||||||
"doggo": "bob"
|
"doggo": "bob"
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let (uuid, mut file) = index_scheduler.create_update_file().unwrap();
|
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(0).unwrap();
|
||||||
let documents_count =
|
let documents_count =
|
||||||
document_formats::read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
document_formats::read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||||
index_scheduler
|
index_scheduler
|
||||||
@ -842,74 +729,15 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
file.persist().unwrap();
|
file.persist().unwrap();
|
||||||
|
|
||||||
// After registering the task we should see the update being enqueued
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
let task = index_scheduler.get_tasks(Query::default()).unwrap();
|
|
||||||
assert_json_snapshot!(task,
|
|
||||||
{ "[].enqueuedAt" => "date", "[].startedAt" => "date", "[].finishedAt" => "date", "[].duration" => "duration" }
|
|
||||||
,@r###"
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"uid": 0,
|
|
||||||
"indexUid": "doggos",
|
|
||||||
"status": "enqueued",
|
|
||||||
"type": "documentAddition",
|
|
||||||
"enqueuedAt": "date"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"###);
|
|
||||||
|
|
||||||
handle.wait_till(Breakpoint::BatchCreated);
|
handle.wait_till(Breakpoint::BatchCreated);
|
||||||
|
|
||||||
// Once the task has started being batched it should be marked as processing
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
let task = index_scheduler.get_tasks(Query::default()).unwrap();
|
|
||||||
assert_json_snapshot!(task,
|
|
||||||
{ "[].enqueuedAt" => "date", "[].startedAt" => "date", "[].finishedAt" => "date", "[].duration" => "duration" }
|
|
||||||
,@r###"
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"uid": 0,
|
|
||||||
"indexUid": "doggos",
|
|
||||||
"status": "processing",
|
|
||||||
"type": "documentAddition",
|
|
||||||
"enqueuedAt": "date",
|
|
||||||
"startedAt": "date"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"###);
|
|
||||||
handle.wait_till(Breakpoint::AfterProcessing);
|
handle.wait_till(Breakpoint::AfterProcessing);
|
||||||
|
|
||||||
let task = index_scheduler.get_tasks(Query::default()).unwrap();
|
assert_snapshot!(snapshot_index_scheduler(&index_scheduler));
|
||||||
assert_json_snapshot!(task,
|
|
||||||
{ "[].enqueuedAt" => "date", "[].startedAt" => "date", "[].finishedAt" => "date", "[].duration" => "duration" }
|
|
||||||
,@r###"
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"uid": 0,
|
|
||||||
"indexUid": "doggos",
|
|
||||||
"status": "succeeded",
|
|
||||||
"type": "documentAddition",
|
|
||||||
"details": {
|
|
||||||
"receivedDocuments": 1,
|
|
||||||
"indexedDocuments": 1
|
|
||||||
},
|
|
||||||
"duration": "duration",
|
|
||||||
"enqueuedAt": "date",
|
|
||||||
"startedAt": "date",
|
|
||||||
"finishedAt": "date"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"###);
|
|
||||||
|
|
||||||
let doggos = index_scheduler.index("doggos").unwrap();
|
|
||||||
|
|
||||||
let rtxn = doggos.read_txn().unwrap();
|
|
||||||
let documents: Vec<_> = doggos
|
|
||||||
.all_documents(&rtxn)
|
|
||||||
.unwrap()
|
|
||||||
.collect::<std::result::Result<_, _>>()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(documents, @r###"[{"id": Number(1), "doggo": String("bob")}]"###);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
@ -13,7 +13,7 @@ use crate::{
|
|||||||
IndexScheduler, Kind, Status,
|
IndexScheduler, Kind, Status,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn snapshot_index(scheduler: &IndexScheduler) -> String {
|
pub fn snapshot_index_scheduler(scheduler: &IndexScheduler) -> String {
|
||||||
let IndexScheduler {
|
let IndexScheduler {
|
||||||
processing_tasks,
|
processing_tasks,
|
||||||
file_store: _,
|
file_store: _,
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, details: { received_documents: 1, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggos", primary_key: Some("id"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
doggos [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: succeeded, details: { received_documents: 1, indexed_documents: 1 }, kind: DocumentImport { index_uid: "doggos", primary_key: Some("id"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued []
|
||||||
|
succeeded [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
doggos [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
["doggos"]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, details: { received_documents: 1, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggos", primary_key: Some("id"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
doggos [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, kind: Snapshot}
|
||||||
|
1 {uid: 1, status: enqueued, kind: Snapshot}
|
||||||
|
2 {uid: 2, status: enqueued, kind: IndexDeletion { index_uid: "doggos" }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,1,2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
"indexDeletion" [2,]
|
||||||
|
"snapshot" [0,1,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
doggos [2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
||||||
|
1 {uid: 1, status: enqueued, details: { received_documents: 12, indexed_documents: 0 }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 12, allow_index_creation: true }}
|
||||||
|
2 {uid: 2, status: enqueued, kind: CancelTask { tasks: [0, 1] }}
|
||||||
|
3 {uid: 3, status: enqueued, details: { received_documents: 50, indexed_documents: 0 }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 50, allow_index_creation: true }}
|
||||||
|
4 {uid: 4, status: enqueued, details: { received_documents: 5000, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000002, documents_count: 5000, allow_index_creation: true }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,1,2,3,4,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [1,3,4,]
|
||||||
|
"indexCreation" [0,]
|
||||||
|
"cancelTask" [2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
catto [0,1,3,]
|
||||||
|
doggo [4,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
||||||
|
1 {uid: 1, status: enqueued, details: { received_documents: 12, indexed_documents: 0 }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 12, allow_index_creation: true }}
|
||||||
|
2 {uid: 2, status: enqueued, details: { received_documents: 5000, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 5000, allow_index_creation: true }}
|
||||||
|
3 {uid: 3, status: enqueued, details: { matched_tasks: 2, deleted_tasks: None, original_query: "test_query" }, kind: DeleteTasks { query: "test_query", tasks: [0, 1] }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,1,2,3,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [1,2,]
|
||||||
|
"indexCreation" [0,]
|
||||||
|
"deleteTasks" [3,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
catto [0,1,]
|
||||||
|
doggo [2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[3,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
||||||
|
1 {uid: 1, status: enqueued, details: { received_documents: 12, indexed_documents: 0 }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 12, allow_index_creation: true }}
|
||||||
|
2 {uid: 2, status: enqueued, details: { received_documents: 5000, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 5000, allow_index_creation: true }}
|
||||||
|
3 {uid: 3, status: enqueued, details: { matched_tasks: 2, deleted_tasks: None, original_query: "test_query" }, kind: DeleteTasks { query: "test_query", tasks: [0, 1] }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,1,2,3,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [1,2,]
|
||||||
|
"indexCreation" [0,]
|
||||||
|
"deleteTasks" [3,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
catto [0,1,]
|
||||||
|
doggo [2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
||||||
|
1 {uid: 1, status: enqueued, details: { received_documents: 12, indexed_documents: 0 }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 12, allow_index_creation: true }}
|
||||||
|
2 {uid: 2, status: enqueued, details: { received_documents: 5000, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 5000, allow_index_creation: true }}
|
||||||
|
3 {uid: 3, status: succeeded, details: { matched_tasks: 2, deleted_tasks: Some(0), original_query: "test_query" }, kind: DeleteTasks { query: "test_query", tasks: [0, 1] }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,1,2,]
|
||||||
|
succeeded [3,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [1,2,]
|
||||||
|
"indexCreation" [0,]
|
||||||
|
"deleteTasks" [3,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
catto [0,1,]
|
||||||
|
doggo [2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
source: index-scheduler/src/lib.rs
|
||||||
|
expression: snapshot_index_scheduler(&index_scheduler)
|
||||||
|
---
|
||||||
|
### Processing Tasks:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### All Tasks:
|
||||||
|
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
||||||
|
1 {uid: 1, status: enqueued, details: { received_documents: 12, indexed_documents: 0 }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 12, allow_index_creation: true }}
|
||||||
|
2 {uid: 2, status: enqueued, details: { received_documents: 5000, indexed_documents: 0 }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 5000, allow_index_creation: true }}
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Status:
|
||||||
|
enqueued [0,1,2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Kind:
|
||||||
|
{"documentImport":{"method":"ReplaceDocuments","allow_index_creation":true}} [1,2,]
|
||||||
|
"indexCreation" [0,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Tasks:
|
||||||
|
catto [0,1,]
|
||||||
|
doggo [2,]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
### Index Mapper:
|
||||||
|
[]
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
@ -317,7 +317,7 @@ impl KindWithContent {
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
KindWithContent::CancelTask { .. } => {
|
KindWithContent::CancelTask { .. } => {
|
||||||
todo!()
|
None // TODO: check correctness of this return value
|
||||||
}
|
}
|
||||||
KindWithContent::DeleteTasks { query, tasks } => Some(Details::DeleteTasks {
|
KindWithContent::DeleteTasks { query, tasks } => Some(Details::DeleteTasks {
|
||||||
matched_tasks: tasks.len(),
|
matched_tasks: tasks.len(),
|
||||||
|
Loading…
Reference in New Issue
Block a user