From b20025c01e79bbf6ebc9bc9d96a26bdbea51dbba Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Wed, 2 Nov 2022 16:31:14 +0100 Subject: [PATCH 1/9] Change the missing_filters error code into missing_task_filters --- meilisearch-types/src/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meilisearch-types/src/error.rs b/meilisearch-types/src/error.rs index 330a6f082..d902bc82a 100644 --- a/meilisearch-types/src/error.rs +++ b/meilisearch-types/src/error.rs @@ -240,10 +240,10 @@ impl Code { } TaskNotFound => ErrCode::invalid("task_not_found", StatusCode::NOT_FOUND), TaskDeletionWithEmptyQuery => { - ErrCode::invalid("missing_filters", StatusCode::BAD_REQUEST) + ErrCode::invalid("missing_task_filters", StatusCode::BAD_REQUEST) } TaskCancelationWithEmptyQuery => { - ErrCode::invalid("missing_filters", StatusCode::BAD_REQUEST) + ErrCode::invalid("missing_task_filters", StatusCode::BAD_REQUEST) } DumpNotFound => ErrCode::invalid("dump_not_found", StatusCode::NOT_FOUND), NoSpaceLeftOnDevice => { From 932414bf72f1ed2cc09c5c1837fdb2fb5a421a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 3 Nov 2022 12:20:54 +0100 Subject: [PATCH 2/9] WIP Introduce the invalid_task_uid error code --- index-scheduler/src/error.rs | 5 +++++ meilisearch-http/src/routes/tasks.rs | 20 +++++++++++++++----- meilisearch-types/src/error.rs | 2 ++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/index-scheduler/src/error.rs b/index-scheduler/src/error.rs index 8c3804a05..7a91dfbd3 100644 --- a/index-scheduler/src/error.rs +++ b/index-scheduler/src/error.rs @@ -27,6 +27,10 @@ pub enum Error { SwapDuplicateIndexesFound(Vec), #[error("Corrupted dump.")] CorruptedDump, + #[error( + "Tasks uids must be a comma-separated list of numbers. `{task_uids}` is invalid {error_message}" + )] + InvalidTaskUids { task_uids: String, error_message: String }, #[error("Task `{0}` not found.")] TaskNotFound(TaskId), #[error("Query parameters to filter the tasks to delete are missing. Available query parameters are: `uid`, `indexUid`, `status`, `type`.")] @@ -71,6 +75,7 @@ impl ErrorCode for Error { Error::IndexAlreadyExists(_) => Code::IndexAlreadyExists, Error::SwapDuplicateIndexesFound(_) => Code::DuplicateIndexFound, Error::SwapDuplicateIndexFound(_) => Code::DuplicateIndexFound, + Error::InvalidTaskUids { .. } => Code::InvalidTaskUid, Error::TaskNotFound(_) => Code::TaskNotFound, Error::TaskDeletionWithEmptyQuery => Code::TaskDeletionWithEmptyQuery, Error::TaskCancelationWithEmptyQuery => Code::TaskCancelationWithEmptyQuery, diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index 0c9a49a3c..500df8716 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -211,7 +211,7 @@ pub struct TaskDateQuery { pub struct TasksFilterQuery { #[serde(rename = "type")] kind: Option>>, - uid: Option>, + uid: Option>, status: Option>>, index_uid: Option>>, #[serde(default = "DEFAULT_LIMIT")] @@ -457,15 +457,25 @@ async fn get_tasks( async fn get_task( index_scheduler: GuardedData, Data>, - task_id: web::Path, + task_uid: web::Path, req: HttpRequest, analytics: web::Data, ) -> Result { - let task_id = task_id.into_inner(); + let task_uid_string = task_uid.into_inner(); + let task_uid: TaskId = match task_uid_string.parse() { + Ok(id) => id, + Err(e) => { + return Err(index_scheduler::Error::InvalidTaskUids { + task_uids: task_uid_string, + error_message: e.to_string(), + } + .into()) + } + }; analytics.publish("Tasks Seen".to_string(), json!({ "per_task_uid": true }), Some(&req)); - let query = index_scheduler::Query { uid: Some(vec![task_id]), ..Query::default() }; + let query = index_scheduler::Query { uid: Some(vec![task_uid]), ..Query::default() }; if let Some(task) = index_scheduler .get_tasks_from_authorized_indexes( @@ -477,7 +487,7 @@ async fn get_task( let task_view = TaskView::from_task(task); Ok(HttpResponse::Ok().json(task_view)) } else { - Err(index_scheduler::Error::TaskNotFound(task_id).into()) + Err(index_scheduler::Error::TaskNotFound(task_uid).into()) } } diff --git a/meilisearch-types/src/error.rs b/meilisearch-types/src/error.rs index d902bc82a..37f7a8a33 100644 --- a/meilisearch-types/src/error.rs +++ b/meilisearch-types/src/error.rs @@ -147,6 +147,7 @@ pub enum Code { MissingMasterKey, NoSpaceLeftOnDevice, DumpNotFound, + InvalidTaskUid, TaskNotFound, TaskDeletionWithEmptyQuery, TaskCancelationWithEmptyQuery, @@ -238,6 +239,7 @@ impl Code { MissingMasterKey => { ErrCode::authentication("missing_master_key", StatusCode::UNAUTHORIZED) } + InvalidTaskUid => ErrCode::invalid("invalid_task_uid", StatusCode::BAD_REQUEST), TaskNotFound => ErrCode::invalid("task_not_found", StatusCode::NOT_FOUND), TaskDeletionWithEmptyQuery => { ErrCode::invalid("missing_task_filters", StatusCode::BAD_REQUEST) From d5638d2c2746c9fca2376879ce70662e19bce8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Mon, 7 Nov 2022 12:24:39 +0100 Subject: [PATCH 3/9] Use more precise error codes/message for the task routes + Allow star operator in delete/cancel tasks + rename originalQuery to originalFilters + Display error/canceled_by in task view even when they are = null + Rename task filter fields by using their plural forms + Prepare an error code for canceledBy filter + Only return global tasks if the API key action `index.*` is there --- index-scheduler/src/error.rs | 38 +- index-scheduler/src/lib.rs | 66 +-- meilisearch-http/src/routes/mod.rs | 2 +- meilisearch-http/src/routes/tasks.rs | 742 ++++++++++++++++++--------- meilisearch-types/src/error.rs | 22 +- meilisearch-types/src/tasks.rs | 18 +- 6 files changed, 606 insertions(+), 282 deletions(-) diff --git a/index-scheduler/src/error.rs b/index-scheduler/src/error.rs index 7a91dfbd3..1cde58905 100644 --- a/index-scheduler/src/error.rs +++ b/index-scheduler/src/error.rs @@ -1,4 +1,5 @@ use meilisearch_types::error::{Code, ErrorCode}; +use meilisearch_types::tasks::{Kind, Status}; use meilisearch_types::{heed, milli}; use thiserror::Error; @@ -28,9 +29,35 @@ pub enum Error { #[error("Corrupted dump.")] CorruptedDump, #[error( - "Tasks uids must be a comma-separated list of numbers. `{task_uids}` is invalid {error_message}" + "Task `{field}` `{date}` is invalid. It should follow the YYYY-MM-DD or RFC 3339 date-time format." )] - InvalidTaskUids { task_uids: String, error_message: String }, + InvalidTaskDate { field: String, date: String }, + #[error("Task uid `{task_uid}` is invalid. It should only contain numeric characters.")] + InvalidTaskUids { task_uid: String }, + #[error( + "Task status `{status}` is invalid. Available task statuses are {}.", + enum_iterator::all::() + .map(|s| format!("`{s}`")) + .collect::>() + .join(", ") + )] + InvalidTaskStatuses { status: String }, + #[error( + "Task type `{type_}` is invalid. Available task types are {}", + enum_iterator::all::() + .map(|s| format!("`{s}`")) + .collect::>() + .join(", ") + )] + InvalidTaskTypes { type_: String }, + #[error( + "Task canceledBy `{canceled_by}` is invalid. It should only contains numeric characters separated by `,` character." + )] + InvalidTaskCanceledBy { canceled_by: String }, + #[error( + "{index_uid} is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_)." + )] + InvalidIndexUid { index_uid: String }, #[error("Task `{0}` not found.")] TaskNotFound(TaskId), #[error("Query parameters to filter the tasks to delete are missing. Available query parameters are: `uid`, `indexUid`, `status`, `type`.")] @@ -75,7 +102,12 @@ impl ErrorCode for Error { Error::IndexAlreadyExists(_) => Code::IndexAlreadyExists, Error::SwapDuplicateIndexesFound(_) => Code::DuplicateIndexFound, Error::SwapDuplicateIndexFound(_) => Code::DuplicateIndexFound, - Error::InvalidTaskUids { .. } => Code::InvalidTaskUid, + Error::InvalidTaskDate { .. } => Code::InvalidTaskDate, + Error::InvalidTaskUids { .. } => Code::InvalidTaskUids, + Error::InvalidTaskStatuses { .. } => Code::InvalidTaskStatuses, + Error::InvalidTaskTypes { .. } => Code::InvalidTaskTypes, + Error::InvalidTaskCanceledBy { .. } => Code::InvalidTaskCanceledBy, + Error::InvalidIndexUid { .. } => Code::InvalidIndexUid, Error::TaskNotFound(_) => Code::TaskNotFound, Error::TaskDeletionWithEmptyQuery => Code::TaskDeletionWithEmptyQuery, Error::TaskCancelationWithEmptyQuery => Code::TaskCancelationWithEmptyQuery, diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 2d782355c..2a9b068ea 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -70,7 +70,7 @@ pub struct Query { /// The minimum [task id](`meilisearch_types::tasks::Task::uid`) to be matched pub from: Option, /// The allowed [statuses](`meilisearch_types::tasks::Task::status`) of the matched tasls - pub status: Option>, + pub statuses: Option>, /// The allowed [kinds](meilisearch_types::tasks::Kind) of the matched tasks. /// /// The kind of a task is given by: @@ -80,11 +80,11 @@ pub struct Query { /// task.kind.as_kind() /// # } /// ``` - pub kind: Option>, + pub types: Option>, /// The allowed [index ids](meilisearch_types::tasks::Task::index_uid) of the matched tasks - pub index_uid: Option>, + pub index_uids: Option>, /// The [task ids](`meilisearch_types::tasks::Task::uid`) to be matched - pub uid: Option>, + pub uids: Option>, /// Exclusive upper bound of the matched tasks' [`enqueued_at`](meilisearch_types::tasks::Task::enqueued_at) field. pub before_enqueued_at: Option, @@ -109,10 +109,10 @@ impl Query { Query { limit: None, from: None, - status: None, - kind: None, - index_uid: None, - uid: None, + statuses: None, + types: None, + index_uids: None, + uids: None, before_enqueued_at: None, after_enqueued_at: None, before_started_at: None, @@ -125,9 +125,9 @@ impl Query { /// Add an [index id](meilisearch_types::tasks::Task::index_uid) to the list of permitted indexes. pub fn with_index(self, index_uid: String) -> Self { - let mut index_vec = self.index_uid.unwrap_or_default(); + let mut index_vec = self.index_uids.unwrap_or_default(); index_vec.push(index_uid); - Self { index_uid: Some(index_vec), ..self } + Self { index_uids: Some(index_vec), ..self } } } @@ -458,7 +458,7 @@ impl IndexScheduler { tasks.remove_range(from.saturating_add(1)..); } - if let Some(status) = &query.status { + if let Some(status) = &query.statuses { let mut status_tasks = RoaringBitmap::new(); for status in status { match status { @@ -475,12 +475,12 @@ impl IndexScheduler { tasks &= status_tasks; } - if let Some(uids) = &query.uid { + if let Some(uids) = &query.uids { let uids = RoaringBitmap::from_iter(uids); tasks &= &uids; } - if let Some(kind) = &query.kind { + if let Some(kind) = &query.types { let mut kind_tasks = RoaringBitmap::new(); for kind in kind { kind_tasks |= self.get_kind(rtxn, *kind)?; @@ -488,7 +488,7 @@ impl IndexScheduler { tasks &= &kind_tasks; } - if let Some(index) = &query.index_uid { + if let Some(index) = &query.index_uids { let mut index_tasks = RoaringBitmap::new(); for index in index { index_tasks |= self.index_tasks(rtxn, index)?; @@ -592,7 +592,7 @@ impl IndexScheduler { // If the query contains a list of `index_uid`, then we must exclude all the kind that // arn't associated to one and only one index. - if query.index_uid.is_some() { + if query.index_uids.is_some() { for kind in enum_iterator::all::().filter(|kind| !kind.related_to_one_index()) { tasks -= self.get_kind(rtxn, kind)?; } @@ -2218,18 +2218,18 @@ mod tests { let rtxn = index_scheduler.env.read_txn().unwrap(); - let query = Query { status: Some(vec![Status::Processing]), ..Default::default() }; + let query = Query { statuses: Some(vec![Status::Processing]), ..Default::default() }; let tasks = index_scheduler.get_task_ids_from_authorized_indexes(&rtxn, &query, &None).unwrap(); snapshot!(snapshot_bitmap(&tasks), @"[0,]"); // only the processing tasks in the first tick - let query = Query { status: Some(vec![Status::Enqueued]), ..Default::default() }; + let query = Query { statuses: Some(vec![Status::Enqueued]), ..Default::default() }; let tasks = index_scheduler.get_task_ids_from_authorized_indexes(&rtxn, &query, &None).unwrap(); snapshot!(snapshot_bitmap(&tasks), @"[1,2,]"); // only the enqueued tasks in the first tick let query = Query { - status: Some(vec![Status::Enqueued, Status::Processing]), + statuses: Some(vec![Status::Enqueued, Status::Processing]), ..Default::default() }; let tasks = @@ -2237,7 +2237,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[0,1,2,]"); // both enqueued and processing tasks in the first tick let query = Query { - status: Some(vec![Status::Enqueued, Status::Processing]), + statuses: Some(vec![Status::Enqueued, Status::Processing]), after_started_at: Some(start_time), ..Default::default() }; @@ -2248,7 +2248,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[0,]"); let query = Query { - status: Some(vec![Status::Enqueued, Status::Processing]), + statuses: Some(vec![Status::Enqueued, Status::Processing]), before_started_at: Some(start_time), ..Default::default() }; @@ -2259,7 +2259,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[]"); let query = Query { - status: Some(vec![Status::Enqueued, Status::Processing]), + statuses: Some(vec![Status::Enqueued, Status::Processing]), after_started_at: Some(start_time), before_started_at: Some(start_time + Duration::minutes(1)), ..Default::default() @@ -2278,7 +2278,7 @@ mod tests { let second_start_time = OffsetDateTime::now_utc(); let query = Query { - status: Some(vec![Status::Succeeded, Status::Processing]), + statuses: Some(vec![Status::Succeeded, Status::Processing]), after_started_at: Some(start_time), before_started_at: Some(start_time + Duration::minutes(1)), ..Default::default() @@ -2291,7 +2291,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[0,1,]"); let query = Query { - status: Some(vec![Status::Succeeded, Status::Processing]), + statuses: Some(vec![Status::Succeeded, Status::Processing]), before_started_at: Some(start_time), ..Default::default() }; @@ -2302,7 +2302,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[]"); let query = Query { - status: Some(vec![Status::Enqueued, Status::Succeeded, Status::Processing]), + statuses: Some(vec![Status::Enqueued, Status::Succeeded, Status::Processing]), after_started_at: Some(second_start_time), before_started_at: Some(second_start_time + Duration::minutes(1)), ..Default::default() @@ -2325,7 +2325,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[2,]"); let query = Query { - status: Some(vec![Status::Enqueued, Status::Succeeded, Status::Processing]), + statuses: Some(vec![Status::Enqueued, Status::Succeeded, Status::Processing]), after_started_at: Some(second_start_time), before_started_at: Some(second_start_time + Duration::minutes(1)), ..Default::default() @@ -2347,7 +2347,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[]"); let query = Query { - status: Some(vec![Status::Failed]), + statuses: Some(vec![Status::Failed]), after_started_at: Some(second_start_time), before_started_at: Some(second_start_time + Duration::minutes(1)), ..Default::default() @@ -2358,7 +2358,7 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[2,]"); let query = Query { - status: Some(vec![Status::Failed]), + statuses: Some(vec![Status::Failed]), after_started_at: Some(second_start_time), before_started_at: Some(second_start_time + Duration::minutes(1)), ..Default::default() @@ -2369,8 +2369,8 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[2,]"); let query = Query { - status: Some(vec![Status::Failed]), - uid: Some(vec![1]), + statuses: Some(vec![Status::Failed]), + uids: Some(vec![1]), after_started_at: Some(second_start_time), before_started_at: Some(second_start_time + Duration::minutes(1)), ..Default::default() @@ -2381,8 +2381,8 @@ mod tests { snapshot!(snapshot_bitmap(&tasks), @"[]"); let query = Query { - status: Some(vec![Status::Failed]), - uid: Some(vec![2]), + statuses: Some(vec![Status::Failed]), + uids: Some(vec![2]), after_started_at: Some(second_start_time), before_started_at: Some(second_start_time + Duration::minutes(1)), ..Default::default() @@ -2417,13 +2417,13 @@ mod tests { let rtxn = index_scheduler.env.read_txn().unwrap(); - let query = Query { index_uid: Some(vec!["catto".to_owned()]), ..Default::default() }; + let query = Query { index_uids: Some(vec!["catto".to_owned()]), ..Default::default() }; let tasks = index_scheduler.get_task_ids_from_authorized_indexes(&rtxn, &query, &None).unwrap(); // only the first task associated with catto is returned, the indexSwap tasks are excluded! snapshot!(snapshot_bitmap(&tasks), @"[0,]"); - let query = Query { index_uid: Some(vec!["catto".to_owned()]), ..Default::default() }; + let query = Query { index_uids: Some(vec!["catto".to_owned()]), ..Default::default() }; let tasks = index_scheduler .get_task_ids_from_authorized_indexes(&rtxn, &query, &Some(vec!["doggo".to_owned()])) .unwrap(); diff --git a/meilisearch-http/src/routes/mod.rs b/meilisearch-http/src/routes/mod.rs index 81e100214..8cf4af718 100644 --- a/meilisearch-http/src/routes/mod.rs +++ b/meilisearch-http/src/routes/mod.rs @@ -271,7 +271,7 @@ pub fn create_all_stats( let mut indexes = BTreeMap::new(); let mut database_size = 0; let processing_task = index_scheduler.get_tasks_from_authorized_indexes( - Query { status: Some(vec![Status::Processing]), limit: Some(1), ..Query::default() }, + Query { statuses: Some(vec![Status::Processing]), limit: Some(1), ..Query::default() }, search_rules.authorized_indexes(), )?; let processing_index = processing_task.first().and_then(|task| task.index_uid()); diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index 500df8716..ac9f2e1a6 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -1,3 +1,5 @@ +use std::str::FromStr; + use actix_web::web::Data; use actix_web::{web, HttpRequest, HttpResponse}; use index_scheduler::{IndexScheduler, Query, TaskId}; @@ -14,6 +16,8 @@ use serde_json::json; use time::{Duration, OffsetDateTime}; use tokio::task; +use self::date_deserializer::{deserialize_date, DeserializeDateOption}; + use super::{fold_star_or, SummarizedTaskView}; use crate::analytics::Analytics; use crate::extractors::authentication::policies::*; @@ -41,15 +45,10 @@ pub struct TaskView { pub status: Status, #[serde(rename = "type")] pub kind: Kind, - - #[serde(skip_serializing_if = "Option::is_none")] pub canceled_by: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub details: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub error: Option, - #[serde(serialize_with = "serialize_duration", default)] pub duration: Option, #[serde(with = "time::serde::rfc3339")] @@ -98,7 +97,7 @@ pub struct DetailsView { #[serde(skip_serializing_if = "Option::is_none")] pub deleted_tasks: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub original_query: Option, + pub original_filters: Option, #[serde(skip_serializing_if = "Option::is_none")] pub dump_uid: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -139,14 +138,14 @@ impl From
for DetailsView { DetailsView { matched_tasks: Some(matched_tasks), canceled_tasks: Some(canceled_tasks), - original_query: Some(original_query), + original_filters: Some(original_query), ..DetailsView::default() } } Details::TaskDeletion { matched_tasks, deleted_tasks, original_query } => DetailsView { matched_tasks: Some(matched_tasks), deleted_tasks: Some(deleted_tasks), - original_query: Some(original_query), + original_filters: Some(original_query), ..DetailsView::default() }, Details::Dump { dump_uid } => { @@ -159,102 +158,276 @@ impl From
for DetailsView { } } -#[derive(Serialize, Deserialize, Debug)] +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct TaskCommonQueryRaw { + uids: Option>, + types: Option>>, + statuses: Option>>, + index_uids: Option>>, +} +impl TaskCommonQueryRaw { + fn validate(self) -> Result { + let Self { uids, types, statuses, index_uids } = self; + let uids = if let Some(uids) = uids { + Some( + uids.into_iter() + .map(|uid_string| { + uid_string.parse::().map_err(|_e| { + index_scheduler::Error::InvalidTaskUids { task_uid: uid_string }.into() + }) + }) + .collect::, ResponseError>>()?, + ) + } else { + None + }; + + let types = if let Some(types) = types.and_then(fold_star_or) as Option> { + Some( + types + .into_iter() + .map(|type_string| { + Kind::from_str(&type_string).map_err(|_e| { + index_scheduler::Error::InvalidTaskTypes { type_: type_string }.into() + }) + }) + .collect::, ResponseError>>()?, + ) + } else { + None + }; + let statuses = if let Some(statuses) = + statuses.and_then(fold_star_or) as Option> + { + Some( + statuses + .into_iter() + .map(|status_string| { + Status::from_str(&status_string).map_err(|_e| { + index_scheduler::Error::InvalidTaskStatuses { status: status_string } + .into() + }) + }) + .collect::, ResponseError>>()?, + ) + } else { + None + }; + + let index_uids = + if let Some(index_uids) = index_uids.and_then(fold_star_or) as Option> { + Some( + index_uids + .into_iter() + .map(|index_uid_string| { + IndexUid::from_str(&index_uid_string) + .map(|index_uid| index_uid.to_string()) + .map_err(|_e| { + index_scheduler::Error::InvalidIndexUid { + index_uid: index_uid_string, + } + .into() + }) + }) + .collect::, ResponseError>>()?, + ) + } else { + None + }; + Ok(TaskCommonQuery { types, uids, statuses, index_uids }) + } +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct TaskDateQueryRaw { + after_enqueued_at: Option, + before_enqueued_at: Option, + after_started_at: Option, + before_started_at: Option, + after_finished_at: Option, + before_finished_at: Option, +} +impl TaskDateQueryRaw { + fn validate(self) -> Result { + let Self { + after_enqueued_at, + before_enqueued_at, + after_started_at, + before_started_at, + after_finished_at, + before_finished_at, + } = self; + + let mut query = TaskDateQuery { + after_enqueued_at: None, + before_enqueued_at: None, + after_started_at: None, + before_started_at: None, + after_finished_at: None, + before_finished_at: None, + }; + + for (field_name, string_value, before_or_after, dest) in [ + ( + "afterEnqueuedAt", + after_enqueued_at, + DeserializeDateOption::After, + &mut query.after_enqueued_at, + ), + ( + "beforeEnqueuedAt", + before_enqueued_at, + DeserializeDateOption::Before, + &mut query.before_enqueued_at, + ), + ( + "afterStartedAt", + after_started_at, + DeserializeDateOption::After, + &mut query.after_started_at, + ), + ( + "beforeStartedAt", + before_started_at, + DeserializeDateOption::Before, + &mut query.before_started_at, + ), + ( + "afterFinishedAt", + after_finished_at, + DeserializeDateOption::After, + &mut query.after_finished_at, + ), + ( + "beforeFinishedAt", + before_finished_at, + DeserializeDateOption::Before, + &mut query.before_finished_at, + ), + ] { + if let Some(string_value) = string_value { + *dest = Some(deserialize_date(field_name, &string_value, before_or_after)?); + } + } + + Ok(query) + } +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct TasksFilterQueryRaw { + #[serde(flatten)] + common: TaskCommonQueryRaw, + #[serde(default = "DEFAULT_LIMIT")] + limit: u32, + from: Option, + #[serde(flatten)] + dates: TaskDateQueryRaw, +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct TaskDeletionOrCancelationQueryRaw { + #[serde(flatten)] + common: TaskCommonQueryRaw, + #[serde(flatten)] + dates: TaskDateQueryRaw, +} + +impl TasksFilterQueryRaw { + fn validate(self) -> Result { + let Self { common, limit, from, dates } = self; + let common = common.validate()?; + let dates = dates.validate()?; + + Ok(TasksFilterQuery { common, limit, from, dates }) + } +} + +impl TaskDeletionOrCancelationQueryRaw { + fn validate(self) -> Result { + let Self { common, dates } = self; + let common = common.validate()?; + let dates = dates.validate()?; + + Ok(TaskDeletionOrCancelationQuery { common, dates }) + } +} + +#[derive(Serialize, Debug)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TaskDateQuery { #[serde( default, skip_serializing_if = "Option::is_none", - serialize_with = "time::serde::rfc3339::option::serialize", - deserialize_with = "date_deserializer::after::deserialize" + serialize_with = "time::serde::rfc3339::option::serialize" )] after_enqueued_at: Option, #[serde( default, skip_serializing_if = "Option::is_none", - serialize_with = "time::serde::rfc3339::option::serialize", - deserialize_with = "date_deserializer::before::deserialize" + serialize_with = "time::serde::rfc3339::option::serialize" )] before_enqueued_at: Option, #[serde( default, skip_serializing_if = "Option::is_none", - serialize_with = "time::serde::rfc3339::option::serialize", - deserialize_with = "date_deserializer::after::deserialize" + serialize_with = "time::serde::rfc3339::option::serialize" )] after_started_at: Option, #[serde( default, skip_serializing_if = "Option::is_none", - serialize_with = "time::serde::rfc3339::option::serialize", - deserialize_with = "date_deserializer::before::deserialize" + serialize_with = "time::serde::rfc3339::option::serialize" )] before_started_at: Option, #[serde( default, skip_serializing_if = "Option::is_none", - serialize_with = "time::serde::rfc3339::option::serialize", - deserialize_with = "date_deserializer::after::deserialize" + serialize_with = "time::serde::rfc3339::option::serialize" )] after_finished_at: Option, #[serde( default, skip_serializing_if = "Option::is_none", - serialize_with = "time::serde::rfc3339::option::serialize", - deserialize_with = "date_deserializer::before::deserialize" + serialize_with = "time::serde::rfc3339::option::serialize" )] before_finished_at: Option, } -#[derive(Deserialize, Debug)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] +#[derive(Debug)] +pub struct TaskCommonQuery { + types: Option>, + uids: Option>, + statuses: Option>, + index_uids: Option>, +} + +#[derive(Debug)] pub struct TasksFilterQuery { - #[serde(rename = "type")] - kind: Option>>, - uid: Option>, - status: Option>>, - index_uid: Option>>, - #[serde(default = "DEFAULT_LIMIT")] limit: u32, from: Option, - #[serde(flatten)] + common: TaskCommonQuery, dates: TaskDateQuery, } -#[derive(Deserialize, Debug)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct TaskDeletionQuery { - #[serde(rename = "type")] - kind: Option>, - uid: Option>, - status: Option>, - index_uid: Option>, - #[serde(flatten)] - dates: TaskDateQuery, -} - -#[derive(Deserialize, Debug)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct TaskCancelationQuery { - #[serde(rename = "type")] - type_: Option>, - uid: Option>, - status: Option>, - index_uid: Option>, - #[serde(flatten)] +#[derive(Debug)] +pub struct TaskDeletionOrCancelationQuery { + common: TaskCommonQuery, dates: TaskDateQuery, } async fn cancel_tasks( index_scheduler: GuardedData, Data>, req: HttpRequest, - params: web::Query, + params: web::Query, ) -> Result { - let TaskCancelationQuery { - type_, - uid, - status, - index_uid, + let query = params.into_inner().validate()?; + let TaskDeletionOrCancelationQuery { + common: TaskCommonQuery { types, uids, statuses, index_uids }, dates: TaskDateQuery { after_enqueued_at, @@ -264,21 +437,15 @@ async fn cancel_tasks( after_finished_at, before_finished_at, }, - } = params.into_inner(); - - let kind: Option> = type_.map(|x| x.into_iter().collect()); - let uid: Option> = uid.map(|x| x.into_iter().collect()); - let status: Option> = status.map(|x| x.into_iter().collect()); - let index_uid: Option> = - index_uid.map(|x| x.into_iter().map(|x| x.to_string()).collect()); + } = query; let query = Query { limit: None, from: None, - status, - kind, - index_uid, - uid, + statuses, + types, + index_uids, + uids, before_enqueued_at, after_enqueued_at, before_started_at, @@ -308,13 +475,10 @@ async fn cancel_tasks( async fn delete_tasks( index_scheduler: GuardedData, Data>, req: HttpRequest, - params: web::Query, + params: web::Query, ) -> Result { - let TaskDeletionQuery { - kind: type_, - uid, - status, - index_uid, + let TaskDeletionOrCancelationQuery { + common: TaskCommonQuery { types, uids, statuses, index_uids }, dates: TaskDateQuery { after_enqueued_at, @@ -324,21 +488,15 @@ async fn delete_tasks( after_finished_at, before_finished_at, }, - } = params.into_inner(); - - let kind: Option> = type_.map(|x| x.into_iter().collect()); - let uid: Option> = uid.map(|x| x.into_iter().collect()); - let status: Option> = status.map(|x| x.into_iter().collect()); - let index_uid: Option> = - index_uid.map(|x| x.into_iter().map(|x| x.to_string()).collect()); + } = params.into_inner().validate()?; let query = Query { limit: None, from: None, - status, - kind, - index_uid, - uid, + statuses, + types, + index_uids, + uids, after_enqueued_at, before_enqueued_at, after_started_at, @@ -375,15 +533,12 @@ pub struct AllTasks { async fn get_tasks( index_scheduler: GuardedData, Data>, - params: web::Query, + params: web::Query, req: HttpRequest, analytics: web::Data, ) -> Result { let TasksFilterQuery { - kind, - uid, - status, - index_uid, + common: TaskCommonQuery { types, uids, statuses, index_uids }, limit, from, dates: @@ -395,21 +550,14 @@ async fn get_tasks( after_finished_at, before_finished_at, }, - } = params.into_inner(); - - // We first transform a potential indexUid=* into a "not specified indexUid filter" - // for every one of the filters: type, status, and indexUid. - let kind: Option> = kind.and_then(fold_star_or); - let uid: Option> = uid.map(|x| x.into_iter().collect()); - let status: Option> = status.and_then(fold_star_or); - let index_uid: Option> = index_uid.and_then(fold_star_or); + } = params.into_inner().validate()?; analytics.publish( "Tasks Seen".to_string(), json!({ - "filtered_by_index_uid": index_uid.as_ref().map_or(false, |v| !v.is_empty()), - "filtered_by_type": kind.as_ref().map_or(false, |v| !v.is_empty()), - "filtered_by_status": status.as_ref().map_or(false, |v| !v.is_empty()), + "filtered_by_index_uid": index_uids.as_ref().map_or(false, |v| !v.is_empty()), + "filtered_by_type": types.as_ref().map_or(false, |v| !v.is_empty()), + "filtered_by_status": statuses.as_ref().map_or(false, |v| !v.is_empty()), }), Some(&req), ); @@ -420,10 +568,10 @@ async fn get_tasks( let query = index_scheduler::Query { limit: Some(limit), from, - status, - kind, - index_uid, - uid, + statuses, + types, + index_uids, + uids, before_enqueued_at, after_enqueued_at, before_started_at, @@ -462,20 +610,17 @@ async fn get_task( analytics: web::Data, ) -> Result { let task_uid_string = task_uid.into_inner(); + let task_uid: TaskId = match task_uid_string.parse() { Ok(id) => id, - Err(e) => { - return Err(index_scheduler::Error::InvalidTaskUids { - task_uids: task_uid_string, - error_message: e.to_string(), - } - .into()) + Err(_e) => { + return Err(index_scheduler::Error::InvalidTaskUids { task_uid: task_uid_string }.into()) } }; analytics.publish("Tasks Seen".to_string(), json!({ "per_task_uid": true }), Some(&req)); - let query = index_scheduler::Query { uid: Some(vec![task_uid]), ..Query::default() }; + let query = index_scheduler::Query { uids: Some(vec![task_uid]), ..Query::default() }; if let Some(task) = index_scheduler .get_tasks_from_authorized_indexes( @@ -492,19 +637,21 @@ async fn get_task( } pub(crate) mod date_deserializer { + use meilisearch_types::error::ResponseError; use time::format_description::well_known::Rfc3339; use time::macros::format_description; use time::{Date, Duration, OffsetDateTime, Time}; - enum DeserializeDateOption { + pub enum DeserializeDateOption { Before, After, } - fn deserialize_date( + pub fn deserialize_date( + field_name: &str, value: &str, option: DeserializeDateOption, - ) -> std::result::Result { + ) -> std::result::Result { // We can't parse using time's rfc3339 format, since then we won't know what part of the // datetime was not explicitly specified, and thus we won't be able to increment it to the // next step. @@ -521,120 +668,17 @@ pub(crate) mod date_deserializer { match option { DeserializeDateOption::Before => Ok(datetime), DeserializeDateOption::After => { - let datetime = datetime - .checked_add(Duration::days(1)) - .ok_or_else(|| serde::de::Error::custom("date overflow"))?; + let datetime = + datetime.checked_add(Duration::days(1)).unwrap_or_else(|| datetime); Ok(datetime) } } } else { - Err(serde::de::Error::custom( - "could not parse a date with the RFC3339 or YYYY-MM-DD format", - )) - } - } - - /// Deserialize an upper bound datetime with RFC3339 or YYYY-MM-DD. - pub(crate) mod before { - use serde::Deserializer; - use time::OffsetDateTime; - - use super::{deserialize_date, DeserializeDateOption}; - - /// Deserialize an [`Option`] from its ISO 8601 representation. - pub fn deserialize<'a, D: Deserializer<'a>>( - deserializer: D, - ) -> Result, D::Error> { - deserializer.deserialize_option(Visitor) - } - - struct Visitor; - - #[derive(Debug)] - struct DeserializeError; - - impl<'a> serde::de::Visitor<'a> for Visitor { - type Value = Option; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str( - "an optional date written as a string with the RFC3339 or YYYY-MM-DD format", - ) - } - - fn visit_str( - self, - value: &str, - ) -> Result, E> { - deserialize_date(value, DeserializeDateOption::Before).map(Some) - } - - fn visit_some>( - self, - deserializer: D, - ) -> Result, D::Error> { - deserializer.deserialize_str(Visitor) - } - - fn visit_none(self) -> Result, E> { - Ok(None) - } - - fn visit_unit(self) -> Result { - Ok(None) - } - } - } - /// Deserialize a lower bound datetime with RFC3339 or YYYY-MM-DD. - /// - /// If YYYY-MM-DD is used, the day is incremented by one. - pub(crate) mod after { - use serde::Deserializer; - use time::OffsetDateTime; - - use super::{deserialize_date, DeserializeDateOption}; - - /// Deserialize an [`Option`] from its ISO 8601 representation. - pub fn deserialize<'a, D: Deserializer<'a>>( - deserializer: D, - ) -> Result, D::Error> { - deserializer.deserialize_option(Visitor) - } - - struct Visitor; - - #[derive(Debug)] - struct DeserializeError; - - impl<'a> serde::de::Visitor<'a> for Visitor { - type Value = Option; - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str( - "an optional date written as a string with the RFC3339 or YYYY-MM-DD format", - ) - } - - fn visit_str( - self, - value: &str, - ) -> Result, E> { - deserialize_date(value, DeserializeDateOption::After).map(Some) - } - - fn visit_some>( - self, - deserializer: D, - ) -> Result, D::Error> { - deserializer.deserialize_str(Visitor) - } - - fn visit_none(self) -> Result, E> { - Ok(None) - } - - fn visit_unit(self) -> Result { - Ok(None) + Err(index_scheduler::Error::InvalidTaskDate { + field: field_name.to_string(), + date: value.to_string(), } + .into()) } } } @@ -643,10 +687,10 @@ pub(crate) mod date_deserializer { mod tests { use meili_snap::snapshot; - use crate::routes::tasks::TaskDeletionQuery; + use crate::routes::tasks::{TaskDeletionOrCancelationQueryRaw, TasksFilterQueryRaw}; #[test] - fn deserialize_task_deletion_query_datetime() { + fn deserialize_task_filter_dates() { { let json = r#" { "afterEnqueuedAt": "2021-12-03", @@ -656,7 +700,10 @@ mod tests { "afterFinishedAt": "2021-12-03", "beforeFinishedAt": "2021-12-03" } "#; - let query = serde_json::from_str::(json).unwrap(); + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); snapshot!(format!("{:?}", query.dates.after_enqueued_at.unwrap()), @"2021-12-04 0:00:00.0 +00:00:00"); snapshot!(format!("{:?}", query.dates.before_enqueued_at.unwrap()), @"2021-12-03 0:00:00.0 +00:00:00"); snapshot!(format!("{:?}", query.dates.after_started_at.unwrap()), @"2021-12-04 0:00:00.0 +00:00:00"); @@ -666,45 +713,256 @@ mod tests { } { let json = r#" { "afterEnqueuedAt": "2021-12-03T23:45:23Z", "beforeEnqueuedAt": "2021-12-03T23:45:23Z" } "#; - let query = serde_json::from_str::(json).unwrap(); + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); snapshot!(format!("{:?}", query.dates.after_enqueued_at.unwrap()), @"2021-12-03 23:45:23.0 +00:00:00"); snapshot!(format!("{:?}", query.dates.before_enqueued_at.unwrap()), @"2021-12-03 23:45:23.0 +00:00:00"); } { let json = r#" { "afterEnqueuedAt": "1997-11-12T09:55:06-06:20" } "#; - let query = serde_json::from_str::(json).unwrap(); + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); snapshot!(format!("{:?}", query.dates.after_enqueued_at.unwrap()), @"1997-11-12 9:55:06.0 -06:20:00"); } { let json = r#" { "afterEnqueuedAt": "1997-11-12T09:55:06+00:00" } "#; - let query = serde_json::from_str::(json).unwrap(); + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); snapshot!(format!("{:?}", query.dates.after_enqueued_at.unwrap()), @"1997-11-12 9:55:06.0 +00:00:00"); } { let json = r#" { "afterEnqueuedAt": "1997-11-12T09:55:06.200000300Z" } "#; - let query = serde_json::from_str::(json).unwrap(); + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); snapshot!(format!("{:?}", query.dates.after_enqueued_at.unwrap()), @"1997-11-12 9:55:06.2000003 +00:00:00"); } { - let json = r#" { "afterEnqueuedAt": "2021" } "#; - let err = serde_json::from_str::(json).unwrap_err(); - snapshot!(format!("{err}"), @"could not parse a date with the RFC3339 or YYYY-MM-DD format at line 1 column 30"); + let json = r#" { "afterFinishedAt": "2021" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task `afterFinishedAt` `2021` is invalid. It should follow the YYYY-MM-DD or RFC 3339 date-time format."); + } + { + let json = r#" { "beforeFinishedAt": "2021" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task `beforeFinishedAt` `2021` is invalid. It should follow the YYYY-MM-DD or RFC 3339 date-time format."); } { let json = r#" { "afterEnqueuedAt": "2021-12" } "#; - let err = serde_json::from_str::(json).unwrap_err(); - snapshot!(format!("{err}"), @"could not parse a date with the RFC3339 or YYYY-MM-DD format at line 1 column 33"); + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task `afterEnqueuedAt` `2021-12` is invalid. It should follow the YYYY-MM-DD or RFC 3339 date-time format."); } { - let json = r#" { "afterEnqueuedAt": "2021-12-03T23" } "#; - let err = serde_json::from_str::(json).unwrap_err(); - snapshot!(format!("{err}"), @"could not parse a date with the RFC3339 or YYYY-MM-DD format at line 1 column 39"); + let json = r#" { "beforeEnqueuedAt": "2021-12-03T23" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task `beforeEnqueuedAt` `2021-12-03T23` is invalid. It should follow the YYYY-MM-DD or RFC 3339 date-time format."); } { - let json = r#" { "afterEnqueuedAt": "2021-12-03T23:45" } "#; - let err = serde_json::from_str::(json).unwrap_err(); - snapshot!(format!("{err}"), @"could not parse a date with the RFC3339 or YYYY-MM-DD format at line 1 column 42"); + let json = r#" { "afterStartedAt": "2021-12-03T23:45" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task `afterStartedAt` `2021-12-03T23:45` is invalid. It should follow the YYYY-MM-DD or RFC 3339 date-time format."); + + let json = r#" { "beforeStartedAt": "2021-12-03T23:45" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task `beforeStartedAt` `2021-12-03T23:45` is invalid. It should follow the YYYY-MM-DD or RFC 3339 date-time format."); + } + } + + #[test] + fn deserialize_task_filter_uids() { + { + let json = r#" { "uids": "78,1,12,73" } "#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.uids.unwrap()), @"[78, 1, 12, 73]"); + } + { + let json = r#" { "uids": "1" } "#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.uids.unwrap()), @"[1]"); + } + { + let json = r#" { "uids": "78,hello,world" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task uid `hello` is invalid. It should only contain numeric characters."); + } + { + let json = r#" { "uids": "cat" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task uid `cat` is invalid. It should only contain numeric characters."); + } + } + + #[test] + fn deserialize_task_filter_status() { + { + let json = r#" { "statuses": "succeeded,failed,enqueued,processing,canceled" } "#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.statuses.unwrap()), @"[Succeeded, Failed, Enqueued, Processing, Canceled]"); + } + { + let json = r#" { "statuses": "enqueued" } "#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.statuses.unwrap()), @"[Enqueued]"); + } + { + let json = r#" { "statuses": "finished" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task status `finished` is invalid. Available task statuses are `enqueued`, `processing`, `succeeded`, `failed`, `canceled`"); + } + } + #[test] + fn deserialize_task_filter_types() { + { + let json = r#" { "types": "documentAdditionOrUpdate,documentDeletion,settingsUpdate,indexCreation,indexDeletion,indexUpdate,indexSwap,taskCancelation,taskDeletion,dumpCreation,snapshotCreation" }"#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.types.unwrap()), @"[DocumentAdditionOrUpdate, DocumentDeletion, SettingsUpdate, IndexCreation, IndexDeletion, IndexUpdate, IndexSwap, TaskCancelation, TaskDeletion, DumpCreation, SnapshotCreation]"); + } + { + let json = r#" { "types": "settingsUpdate" } "#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.types.unwrap()), @"[SettingsUpdate]"); + } + { + let json = r#" { "types": "createIndex" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"Task type `createIndex` is invalid. Available task types are `documentAdditionOrUpdate`, `documentDeletion`, `settingsUpdate`, `indexCreation`, `indexDeletion`, `indexUpdate`, `indexSwap`, `taskCancelation`, `taskDeletion`, `dumpCreation`, `snapshotCreation`"); + } + } + #[test] + fn deserialize_task_filter_index_uids() { + { + let json = r#" { "indexUids": "toto,tata-78" }"#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.index_uids.unwrap()), @r###"["toto", "tata-78"]"###); + } + { + let json = r#" { "indexUids": "index_a" } "#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query.common.index_uids.unwrap()), @r###"["index_a"]"###); + } + { + let json = r#" { "indexUids": "1,hé" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"hé is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_)."); + } + { + let json = r#" { "indexUids": "hé" } "#; + let err = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap_err(); + snapshot!(format!("{err}"), @"hé is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_)."); + } + } + + #[test] + fn deserialize_task_filter_general() { + { + let json = r#" { "from": 12, "limit": 15, "indexUids": "toto,tata-78", "statuses": "succeeded,enqueued", "afterEnqueuedAt": "2012-04-23", "uids": "1,2,3" }"#; + let query = + serde_json::from_str::(json).unwrap().validate().unwrap(); + snapshot!(format!("{:?}", query), @r###"TasksFilterQuery { limit: 15, from: Some(12), common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), statuses: Some([Succeeded, Enqueued]), index_uids: Some(["toto", "tata-78"]) }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"###); + } + { + // Stars should translate to `None` in the query + // Verify value of the default limit + let json = r#" { "indexUids": "*", "statuses": "succeeded,*", "afterEnqueuedAt": "2012-04-23", "uids": "1,2,3" }"#; + let query = + serde_json::from_str::(json).unwrap().validate().unwrap(); + snapshot!(format!("{:?}", query), @"TasksFilterQuery { limit: 20, from: None, common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), statuses: None, index_uids: None }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"); + } + { + // Stars should also translate to `None` in task deletion/cancelation queries + let json = r#" { "indexUids": "*", "statuses": "succeeded,*", "afterEnqueuedAt": "2012-04-23", "uids": "1,2,3" }"#; + let query = serde_json::from_str::(json) + .unwrap() + .validate() + .unwrap(); + snapshot!(format!("{:?}", query), @"TaskDeletionOrCancelationQuery { common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), statuses: None, index_uids: None }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"); + } + { + // Stars in uids not allowed + let json = r#" { "uids": "*" }"#; + let err = + serde_json::from_str::(json).unwrap().validate().unwrap_err(); + snapshot!(format!("{err}"), @"Task uid `*` is invalid. It should only contain numeric characters."); + } + { + // From not allowed in task deletion/cancelation queries + let json = r#" { "from": 12 }"#; + let err = serde_json::from_str::(json).unwrap_err(); + snapshot!(format!("{err}"), @"unknown field `from` at line 1 column 15"); + } + { + // Limit not allowed in task deletion/cancelation queries + let json = r#" { "limit": 12 }"#; + let err = serde_json::from_str::(json).unwrap_err(); + snapshot!(format!("{err}"), @"unknown field `limit` at line 1 column 16"); } } } diff --git a/meilisearch-types/src/error.rs b/meilisearch-types/src/error.rs index 37f7a8a33..c81241741 100644 --- a/meilisearch-types/src/error.rs +++ b/meilisearch-types/src/error.rs @@ -147,7 +147,11 @@ pub enum Code { MissingMasterKey, NoSpaceLeftOnDevice, DumpNotFound, - InvalidTaskUid, + InvalidTaskDate, + InvalidTaskStatuses, + InvalidTaskTypes, + InvalidTaskCanceledBy, + InvalidTaskUids, TaskNotFound, TaskDeletionWithEmptyQuery, TaskCancelationWithEmptyQuery, @@ -239,7 +243,21 @@ impl Code { MissingMasterKey => { ErrCode::authentication("missing_master_key", StatusCode::UNAUTHORIZED) } - InvalidTaskUid => ErrCode::invalid("invalid_task_uid", StatusCode::BAD_REQUEST), + InvalidTaskDate => { + ErrCode::invalid("invalid_task_date_filter", StatusCode::BAD_REQUEST) + } + InvalidTaskUids => { + ErrCode::invalid("invalid_task_uids_filter", StatusCode::BAD_REQUEST) + } + InvalidTaskStatuses => { + ErrCode::invalid("invalid_task_statuses_filter", StatusCode::BAD_REQUEST) + } + InvalidTaskTypes => { + ErrCode::invalid("invalid_task_types_filter", StatusCode::BAD_REQUEST) + } + InvalidTaskCanceledBy => { + ErrCode::invalid("invalid_task_canceled_by_filter", StatusCode::BAD_REQUEST) + } TaskNotFound => ErrCode::invalid("task_not_found", StatusCode::NOT_FOUND), TaskDeletionWithEmptyQuery => { ErrCode::invalid("missing_task_filters", StatusCode::BAD_REQUEST) diff --git a/meilisearch-types/src/tasks.rs b/meilisearch-types/src/tasks.rs index aafa3008e..af9a4d537 100644 --- a/meilisearch-types/src/tasks.rs +++ b/meilisearch-types/src/tasks.rs @@ -398,7 +398,23 @@ impl Kind { } } } - +impl Display for Kind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Kind::DocumentAdditionOrUpdate => write!(f, "documentAdditionOrUpdate"), + Kind::DocumentDeletion => write!(f, "documentDeletion"), + Kind::SettingsUpdate => write!(f, "settingsUpdate"), + Kind::IndexCreation => write!(f, "indexCreation"), + Kind::IndexDeletion => write!(f, "indexDeletion"), + Kind::IndexUpdate => write!(f, "indexUpdate"), + Kind::IndexSwap => write!(f, "indexSwap"), + Kind::TaskCancelation => write!(f, "taskCancelation"), + Kind::TaskDeletion => write!(f, "taskDeletion"), + Kind::DumpCreation => write!(f, "dumpCreation"), + Kind::SnapshotCreation => write!(f, "snapshotCreation"), + } + } +} impl FromStr for Kind { type Err = ResponseError; From 20fa1039923b8c6c50bd8fad6fe4a4343af2c600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 8 Nov 2022 11:46:41 +0100 Subject: [PATCH 4/9] Add canceledBy task filter --- index-scheduler/src/batch.rs | 16 ++++ index-scheduler/src/insta_snapshot.rs | 18 ++++- index-scheduler/src/lib.rs | 80 ++++++++++++++----- .../cancel_processed.snap | 4 + .../initial_tasks_enqueued.snap | 3 + .../cancel_mix_of_tasks/cancel_processed.snap | 4 + .../first_task_processed.snap | 3 + ...rocessing_second_task_cancel_enqueued.snap | 3 + .../cancel_processed.snap | 4 + .../cancel_task_registered.snap} | 13 ++- .../initial_task_processing.snap | 3 + .../cancel_processed.snap | 4 + .../initial_task_processed.snap | 3 + .../all_tasks_processed.snap | 3 + .../snapshots/lib.rs/document_addition/1.snap | 3 + .../snapshots/lib.rs/document_addition/2.snap | 3 + .../snapshots/lib.rs/document_addition/3.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../document_addition_batch_created.snap | 3 + .../document_addition_failed.snap | 3 + .../index_creation_failed.snap | 3 + ...eeded_but_index_scheduler_not_updated.snap | 3 + .../second_iteration.snap | 3 + .../1.snap | 3 + .../index_creation_failed.snap | 3 + .../all_tasks_processed.snap | 3 + .../all_tasks_processed.snap | 3 + .../lib.rs/query_tasks_canceled_by/start.snap | 53 ++++++++++++ .../query_tasks_from_and_limit/finished.snap | 3 + .../query_tasks_from_and_limit/start.snap | 3 + .../lib.rs/query_tasks_simple/end.snap | 3 + .../lib.rs/query_tasks_simple/start.snap | 3 + .../query_tasks_special_rules/start.snap | 3 + .../src/snapshots/lib.rs/register/1.snap | 3 + .../swap_indexes/first_swap_processed.snap | 3 + .../swap_indexes/initial_tasks_processed.snap | 3 + .../swap_indexes/second_swap_processed.snap | 3 + .../third_empty_swap_processed.snap | 3 + .../swap_indexes/two_swaps_registered.snap | 3 + .../first_swap_failed.snap | 3 + .../initial_tasks_processed.snap | 3 + .../initial_tasks_enqueued.snap | 3 + .../initial_tasks_processed.snap | 3 + .../task_deletion_processed.snap | 3 + .../initial_tasks_enqueued.snap | 3 + .../initial_tasks_processed.snap | 3 + .../task_deletion_processed.snap | 3 + .../initial_tasks_enqueued.snap | 3 + .../task_deletion_done.snap | 3 + .../task_deletion_enqueued.snap | 3 + .../task_deletion_processing.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../3.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../3.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../3.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../lib.rs/test_document_replace/1.snap | 3 + .../lib.rs/test_document_replace/2.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../3.snap | 3 + .../lib.rs/test_document_update/1.snap | 3 + .../lib.rs/test_document_update/2.snap | 3 + .../1.snap | 3 + .../2.snap | 3 + .../3.snap | 3 + .../test_mixed_document_addition/1.snap | 3 + .../test_mixed_document_addition/2.snap | 3 + meilisearch-http/src/routes/tasks.rs | 32 ++++++-- 82 files changed, 415 insertions(+), 29 deletions(-) rename index-scheduler/src/snapshots/lib.rs/{fail_in_create_batch_for_index_creation/1.snap => cancel_processing_task/cancel_task_registered.snap} (58%) create mode 100644 index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index 31c338bb5..85b9b41d4 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -1187,6 +1187,7 @@ impl IndexScheduler { let mut affected_indexes = HashSet::new(); let mut affected_statuses = HashSet::new(); let mut affected_kinds = HashSet::new(); + let mut affected_canceled_by = RoaringBitmap::new(); for task_id in to_delete_tasks.iter() { let task = self.get_task(wtxn, task_id)?.ok_or(Error::CorruptedTaskQueue)?; @@ -1205,6 +1206,9 @@ impl IndexScheduler { if let Some(finished_at) = task.finished_at { utils::remove_task_datetime(wtxn, self.finished_at, finished_at, task.uid)?; } + if let Some(canceled_by) = task.canceled_by { + affected_canceled_by.insert(canceled_by); + } } for index in affected_indexes { @@ -1222,6 +1226,17 @@ impl IndexScheduler { for task in to_delete_tasks.iter() { self.all_tasks.delete(wtxn, &BEU32::new(task))?; } + for canceled_by in affected_canceled_by { + let canceled_by = BEU32::new(canceled_by); + if let Some(mut tasks) = self.canceled_by.get(wtxn, &canceled_by)? { + tasks -= &to_delete_tasks; + if tasks.is_empty() { + self.canceled_by.delete(wtxn, &canceled_by)?; + } else { + self.canceled_by.put(wtxn, &canceled_by, &tasks)?; + } + } + } Ok(to_delete_tasks.len()) } @@ -1259,6 +1274,7 @@ impl IndexScheduler { task.finished_at = Some(now); self.update_task(wtxn, &task)?; } + self.canceled_by.put(wtxn, &BEU32::new(cancel_task_id), &tasks_to_cancel)?; Ok(content_files_to_delete) } diff --git a/index-scheduler/src/insta_snapshot.rs b/index-scheduler/src/insta_snapshot.rs index 50846c555..84e1c257f 100644 --- a/index-scheduler/src/insta_snapshot.rs +++ b/index-scheduler/src/insta_snapshot.rs @@ -20,6 +20,7 @@ pub fn snapshot_index_scheduler(scheduler: &IndexScheduler) -> String { status, kind, index_tasks, + canceled_by, enqueued_at, started_at, finished_at, @@ -64,6 +65,10 @@ pub fn snapshot_index_scheduler(scheduler: &IndexScheduler) -> String { snap.push_str(&snapshot_index_mapper(&rtxn, index_mapper)); snap.push_str("\n----------------------------------------------------------------------\n"); + snap.push_str("### Canceled By:\n"); + snap.push_str(&snapshot_canceled_by(&rtxn, *canceled_by)); + snap.push_str("\n----------------------------------------------------------------------\n"); + snap.push_str("### Enqueued At:\n"); snap.push_str(&snapshot_date_db(&rtxn, *enqueued_at)); snap.push_str("----------------------------------------------------------------------\n"); @@ -231,7 +236,18 @@ pub fn snapshot_index_tasks(rtxn: &RoTxn, db: Database) } snap } - +pub fn snapshot_canceled_by( + rtxn: &RoTxn, + db: Database, RoaringBitmapCodec>, +) -> String { + let mut snap = String::new(); + let iter = db.iter(rtxn).unwrap(); + for next in iter { + let (kind, task_ids) = next.unwrap(); + writeln!(snap, "{kind} {}", snapshot_bitmap(&task_ids)).unwrap(); + } + snap +} pub fn snapshot_index_mapper(rtxn: &RoTxn, mapper: &IndexMapper) -> String { let names = mapper.indexes(rtxn).unwrap().into_iter().map(|(n, _)| n).collect::>(); format!("{names:?}") diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 2a9b068ea..1655acdac 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -85,7 +85,9 @@ pub struct Query { pub index_uids: Option>, /// The [task ids](`meilisearch_types::tasks::Task::uid`) to be matched pub uids: Option>, - + /// The [task ids](`meilisearch_types::tasks::Task::uid`) of the [`TaskCancelation`](meilisearch_types::tasks::Task::Kind::TaskCancelation) tasks + /// that canceled the matched tasks. + pub canceled_by: Option>, /// Exclusive upper bound of the matched tasks' [`enqueued_at`](meilisearch_types::tasks::Task::enqueued_at) field. pub before_enqueued_at: Option, /// Exclusive lower bound of the matched tasks' [`enqueued_at`](meilisearch_types::tasks::Task::enqueued_at) field. @@ -113,6 +115,7 @@ impl Query { types: None, index_uids: None, uids: None, + canceled_by: None, before_enqueued_at: None, after_enqueued_at: None, before_started_at: None, @@ -185,6 +188,7 @@ mod db_name { pub const STATUS: &str = "status"; pub const KIND: &str = "kind"; pub const INDEX_TASKS: &str = "index-tasks"; + pub const CANCELED_BY: &str = "canceled_by"; pub const ENQUEUED_AT: &str = "enqueued-at"; pub const STARTED_AT: &str = "started-at"; pub const FINISHED_AT: &str = "finished-at"; @@ -256,6 +260,9 @@ pub struct IndexScheduler { /// Store the tasks associated to an index. pub(crate) index_tasks: Database, + /// Store the tasks that were canceled by a task uid + pub(crate) canceled_by: Database, RoaringBitmapCodec>, + /// Store the task ids of tasks which were enqueued at a specific date pub(crate) enqueued_at: Database, CboRoaringBitmapCodec>, @@ -316,6 +323,7 @@ impl IndexScheduler { status: self.status, kind: self.kind, index_tasks: self.index_tasks, + canceled_by: self.canceled_by, enqueued_at: self.enqueued_at, started_at: self.started_at, finished_at: self.finished_at, @@ -349,7 +357,7 @@ impl IndexScheduler { std::fs::create_dir_all(&options.dumps_path)?; let env = heed::EnvOpenOptions::new() - .max_dbs(9) + .max_dbs(10) .map_size(options.task_db_size) .open(options.tasks_path)?; let file_store = FileStore::new(&options.update_file_path)?; @@ -363,6 +371,7 @@ impl IndexScheduler { status: env.create_database(Some(db_name::STATUS))?, kind: env.create_database(Some(db_name::KIND))?, index_tasks: env.create_database(Some(db_name::INDEX_TASKS))?, + canceled_by: env.create_database(Some(db_name::CANCELED_BY))?, enqueued_at: env.create_database(Some(db_name::ENQUEUED_AT))?, started_at: env.create_database(Some(db_name::STARTED_AT))?, finished_at: env.create_database(Some(db_name::FINISHED_AT))?, @@ -403,7 +412,6 @@ impl IndexScheduler { /// only once per index scheduler. fn run(&self) { let run = self.private_clone(); - std::thread::spawn(move || loop { run.wake_up.wait(); @@ -422,6 +430,7 @@ impl IndexScheduler { ) { std::thread::sleep(Duration::from_secs(1)); } + run.wake_up.signal(); } } }); @@ -480,6 +489,16 @@ impl IndexScheduler { tasks &= &uids; } + if let Some(canceled_by) = &query.canceled_by { + for cancel_task_uid in canceled_by { + if let Some(canceled_by_uid) = + self.canceled_by.get(rtxn, &BEU32::new(*cancel_task_uid))? + { + tasks &= canceled_by_uid; + } + } + } + if let Some(kind) = &query.types { let mut kind_tasks = RoaringBitmap::new(); for kind in kind { @@ -590,9 +609,9 @@ impl IndexScheduler { ) -> Result { let mut tasks = self.get_task_ids(rtxn, query)?; - // If the query contains a list of `index_uid`, then we must exclude all the kind that - // arn't associated to one and only one index. - if query.index_uids.is_some() { + // If the query contains a list of index uid or there is a finite list of authorized indexes, + // then we must exclude all the kinds that aren't associated to one and only one index. + if query.index_uids.is_some() || authorized_indexes.is_some() { for kind in enum_iterator::all::().filter(|kind| !kind.related_to_one_index()) { tasks -= self.get_kind(rtxn, kind)?; } @@ -1786,6 +1805,7 @@ mod tests { .unwrap(); index_scheduler.assert_internally_consistent(); + snapshot!(snapshot_index_scheduler(&index_scheduler), name: "cancel_task_registered"); // Now we check that we can reach the AbortedIndexation error handling handle.wait_till(Breakpoint::AbortedIndexation); index_scheduler.assert_internally_consistent(); @@ -2449,7 +2469,7 @@ mod tests { .unwrap(); // we asked for all the tasks, but we are only authorized to retrieve the doggo and catto tasks // -> all tasks except the swap of catto with whalo are returned - snapshot!(snapshot_bitmap(&tasks), @"[0,1,2,]"); + snapshot!(snapshot_bitmap(&tasks), @"[0,1,]"); let query = Query::default(); let tasks = @@ -2459,23 +2479,43 @@ mod tests { } #[test] - fn fail_in_create_batch_for_index_creation() { + fn query_tasks_canceled_by() { let (index_scheduler, handle) = - IndexScheduler::test(true, vec![(1, FailureLocation::InsideCreateBatch)]); + IndexScheduler::test(true, vec![(3, FailureLocation::InsideProcessBatch)]); - let kinds = [index_creation_task("catto", "mouse")]; + let kind = index_creation_task("catto", "mouse"); + let _ = index_scheduler.register(kind).unwrap(); + let kind = index_creation_task("doggo", "sheep"); + let _ = index_scheduler.register(kind).unwrap(); + let kind = KindWithContent::IndexSwap { + swaps: vec![IndexSwap { indexes: ("catto".to_owned(), "doggo".to_owned()) }], + }; + let _task = index_scheduler.register(kind).unwrap(); - for kind in kinds { - let _task = index_scheduler.register(kind).unwrap(); - index_scheduler.assert_internally_consistent(); - } - handle.wait_till(Breakpoint::BatchCreated); + handle.advance_n_batch(1); + let kind = KindWithContent::TaskCancelation { + query: "test_query".to_string(), + tasks: [0, 1, 2, 3].into_iter().collect(), + }; + let task_cancelation = index_scheduler.register(kind).unwrap(); + handle.advance_n_batch(1); - // We skipped an iteration of `tick` to reach BatchCreated - assert_eq!(*index_scheduler.run_loop_iteration.read().unwrap(), 2); - // Otherwise nothing weird happened - index_scheduler.assert_internally_consistent(); - snapshot!(snapshot_index_scheduler(&index_scheduler)); + snapshot!(snapshot_index_scheduler(&index_scheduler), name: "start"); + + let rtxn = index_scheduler.read_txn().unwrap(); + let query = Query { canceled_by: Some(vec![task_cancelation.uid]), ..Query::default() }; + let tasks = + index_scheduler.get_task_ids_from_authorized_indexes(&rtxn, &query, &None).unwrap(); + // 0 is not returned because it was not canceled, 3 is not returned because it is the uid of the + // taskCancelation itself + snapshot!(snapshot_bitmap(&tasks), @"[1,2,]"); + + let query = Query { canceled_by: Some(vec![task_cancelation.uid]), ..Query::default() }; + let tasks = index_scheduler + .get_task_ids_from_authorized_indexes(&rtxn, &query, &Some(vec!["doggo".to_string()])) + .unwrap(); + // Return only 1 because the user is not authorized to see task 2 + snapshot!(snapshot_bitmap(&tasks), @"[1,]"); } #[test] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap index 659a325c5..ef9a54f9c 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap @@ -23,6 +23,10 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: +1 [0,] + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap index 6b44b0acc..5bbb74c82 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap @@ -21,6 +21,9 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap index 675ba268d..42f4ce8fa 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap @@ -27,6 +27,10 @@ wolfo [2,] ---------------------------------------------------------------------- ### Index Mapper: ["beavero", "catto"] +---------------------------------------------------------------------- +### Canceled By: +3 [1,2,] + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/first_task_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/first_task_processed.snap index 8e3ef1692..36d34ff93 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/first_task_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/first_task_processed.snap @@ -24,6 +24,9 @@ wolfo [2,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap index 219ea9968..194567da1 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap @@ -26,6 +26,9 @@ wolfo [2,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap index 0eb9838c7..237eed237 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap @@ -23,6 +23,10 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: +1 [0,] + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/fail_in_create_batch_for_index_creation/1.snap b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_task_registered.snap similarity index 58% rename from index-scheduler/src/snapshots/lib.rs/fail_in_create_batch_for_index_creation/1.snap rename to index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_task_registered.snap index b78d63444..335511562 100644 --- a/index-scheduler/src/snapshots/lib.rs/fail_in_create_batch_for_index_creation/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_task_registered.snap @@ -6,28 +6,35 @@ source: index-scheduler/src/lib.rs [0,] ---------------------------------------------------------------------- ### All Tasks: -0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }} +0 {uid: 0, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} +1 {uid: 1, status: enqueued, details: { matched_tasks: 1, canceled_tasks: None, original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: -enqueued [0,] +enqueued [0,1,] ---------------------------------------------------------------------- ### Kind: -"indexCreation" [0,] +"documentAdditionOrUpdate" [0,] +"taskCancelation" [1,] ---------------------------------------------------------------------- ### Index Tasks: catto [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] +[timestamp] [1,] ---------------------------------------------------------------------- ### Started At: ---------------------------------------------------------------------- ### Finished At: ---------------------------------------------------------------------- ### File Store: +00000000-0000-0000-0000-000000000000 ---------------------------------------------------------------------- diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/initial_task_processing.snap b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/initial_task_processing.snap index 9bcfbd2b3..905cec451 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/initial_task_processing.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/initial_task_processing.snap @@ -19,6 +19,9 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap index 7f071b2f2..68ed945a8 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap @@ -22,6 +22,10 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: +1 [] + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/initial_task_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/initial_task_processed.snap index d16658b72..e52a80fae 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/initial_task_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/initial_task_processed.snap @@ -20,6 +20,9 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/do_not_batch_task_of_different_indexes/all_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/do_not_batch_task_of_different_indexes/all_tasks_processed.snap index 8541c7c1b..f9195857a 100644 --- a/index-scheduler/src/snapshots/lib.rs/do_not_batch_task_of_different_indexes/all_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/do_not_batch_task_of_different_indexes/all_tasks_processed.snap @@ -28,6 +28,9 @@ girafos [2,5,] ---------------------------------------------------------------------- ### Index Mapper: ["cattos", "doggos", "girafos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition/1.snap b/index-scheduler/src/snapshots/lib.rs/document_addition/1.snap index 6abb00f81..3e654a0e2 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition/1.snap @@ -19,6 +19,9 @@ doggos [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition/2.snap b/index-scheduler/src/snapshots/lib.rs/document_addition/2.snap index b9e745cf0..10291b206 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition/2.snap @@ -19,6 +19,9 @@ doggos [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition/3.snap b/index-scheduler/src/snapshots/lib.rs/document_addition/3.snap index 2bcc9368d..6079a4317 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition/3.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition/3.snap @@ -20,6 +20,9 @@ doggos [0,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap index 448988c8c..1f730c685 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap @@ -23,6 +23,9 @@ doggos [0,1,2,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap index 6954d37e0..2ff82bfd2 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap @@ -24,6 +24,9 @@ doggos [0,1,2,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/1.snap b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/1.snap index 3f921934d..5b29f06a0 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/1.snap @@ -21,6 +21,9 @@ doggos [0,1,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/2.snap b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/2.snap index 2abd3e4cf..f8586b7b8 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion_on_unexisting_index/2.snap @@ -22,6 +22,9 @@ doggos [0,1,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_batch_created.snap b/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_batch_created.snap index b9e745cf0..10291b206 100644 --- a/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_batch_created.snap +++ b/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_batch_created.snap @@ -19,6 +19,9 @@ doggos [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_failed.snap b/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_failed.snap index 750edbbf2..5db6a222a 100644 --- a/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_failed.snap +++ b/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_document_addition/document_addition_failed.snap @@ -20,6 +20,9 @@ doggos [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_index_creation/index_creation_failed.snap b/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_index_creation/index_creation_failed.snap index 11bfb09c1..252ae082e 100644 --- a/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_index_creation/index_creation_failed.snap +++ b/index-scheduler/src/snapshots/lib.rs/fail_in_process_batch_for_index_creation/index_creation_failed.snap @@ -20,6 +20,9 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/document_addition_succeeded_but_index_scheduler_not_updated.snap b/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/document_addition_succeeded_but_index_scheduler_not_updated.snap index 6abb00f81..3e654a0e2 100644 --- a/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/document_addition_succeeded_but_index_scheduler_not_updated.snap +++ b/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/document_addition_succeeded_but_index_scheduler_not_updated.snap @@ -19,6 +19,9 @@ doggos [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/second_iteration.snap b/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/second_iteration.snap index 2bcc9368d..6079a4317 100644 --- a/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/second_iteration.snap +++ b/index-scheduler/src/snapshots/lib.rs/fail_in_update_task_after_process_batch_success_for_document_addition/second_iteration.snap @@ -20,6 +20,9 @@ doggos [0,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/insert_task_while_another_task_is_processing/1.snap b/index-scheduler/src/snapshots/lib.rs/insert_task_while_another_task_is_processing/1.snap index ddac65249..295dcbf20 100644 --- a/index-scheduler/src/snapshots/lib.rs/insert_task_while_another_task_is_processing/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/insert_task_while_another_task_is_processing/1.snap @@ -23,6 +23,9 @@ index_b [1,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/panic_in_process_batch_for_index_creation/index_creation_failed.snap b/index-scheduler/src/snapshots/lib.rs/panic_in_process_batch_for_index_creation/index_creation_failed.snap index 211c67326..60d8c4cdb 100644 --- a/index-scheduler/src/snapshots/lib.rs/panic_in_process_batch_for_index_creation/index_creation_failed.snap +++ b/index-scheduler/src/snapshots/lib.rs/panic_in_process_batch_for_index_creation/index_creation_failed.snap @@ -20,6 +20,9 @@ catto [0,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/process_tasks_inserted_without_new_signal/all_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/process_tasks_inserted_without_new_signal/all_tasks_processed.snap index c75964581..c7190dd8b 100644 --- a/index-scheduler/src/snapshots/lib.rs/process_tasks_inserted_without_new_signal/all_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/process_tasks_inserted_without_new_signal/all_tasks_processed.snap @@ -24,6 +24,9 @@ doggos [0,2,] ---------------------------------------------------------------------- ### Index Mapper: ["cattos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/process_tasks_without_autobatching/all_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/process_tasks_without_autobatching/all_tasks_processed.snap index 44ce75ebb..e52c36718 100644 --- a/index-scheduler/src/snapshots/lib.rs/process_tasks_without_autobatching/all_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/process_tasks_without_autobatching/all_tasks_processed.snap @@ -24,6 +24,9 @@ doggos [0,1,2,3,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap b/index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap new file mode 100644 index 000000000..d4d934e5f --- /dev/null +++ b/index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap @@ -0,0 +1,53 @@ +--- +source: index-scheduler/src/lib.rs +--- +### Autobatching Enabled = true +### Processing Tasks: +[] +---------------------------------------------------------------------- +### All Tasks: +0 {uid: 0, status: succeeded, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }} +1 {uid: 1, status: canceled, canceled_by: 3, details: { primary_key: Some("sheep") }, kind: IndexCreation { index_uid: "doggo", primary_key: Some("sheep") }} +2 {uid: 2, status: canceled, canceled_by: 3, details: { swaps: [IndexSwap { indexes: ("catto", "doggo") }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("catto", "doggo") }] }} +3 {uid: 3, status: succeeded, details: { matched_tasks: 3, canceled_tasks: Some(0), original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0, 1, 2]> }} +---------------------------------------------------------------------- +### Status: +enqueued [] +succeeded [0,3,] +canceled [1,2,] +---------------------------------------------------------------------- +### Kind: +"indexCreation" [0,1,] +"indexSwap" [2,] +"taskCancelation" [3,] +---------------------------------------------------------------------- +### Index Tasks: +catto [0,2,] +doggo [1,2,] +---------------------------------------------------------------------- +### Index Mapper: +["catto"] +---------------------------------------------------------------------- +### Canceled By: +3 [1,2,] + +---------------------------------------------------------------------- +### Enqueued At: +[timestamp] [0,] +[timestamp] [1,] +[timestamp] [2,] +[timestamp] [3,] +---------------------------------------------------------------------- +### Started At: +[timestamp] [0,] +[timestamp] [3,] +---------------------------------------------------------------------- +### Finished At: +[timestamp] [0,] +[timestamp] [1,2,] +[timestamp] [3,] +---------------------------------------------------------------------- +### File Store: + +---------------------------------------------------------------------- + diff --git a/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/finished.snap b/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/finished.snap index dff6707f4..694bbff26 100644 --- a/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/finished.snap +++ b/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/finished.snap @@ -24,6 +24,9 @@ whalo [1,] ---------------------------------------------------------------------- ### Index Mapper: ["catto", "doggo", "whalo"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/start.snap b/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/start.snap index 2717569f4..8427679e7 100644 --- a/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/start.snap +++ b/index-scheduler/src/snapshots/lib.rs/query_tasks_from_and_limit/start.snap @@ -23,6 +23,9 @@ whalo [1,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/end.snap b/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/end.snap index 6b7ec2a2a..65838db64 100644 --- a/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/end.snap +++ b/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/end.snap @@ -25,6 +25,9 @@ whalo [2,] ---------------------------------------------------------------------- ### Index Mapper: ["catto", "doggo"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/start.snap b/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/start.snap index 60c8de558..aed5aed8c 100644 --- a/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/start.snap +++ b/index-scheduler/src/snapshots/lib.rs/query_tasks_simple/start.snap @@ -23,6 +23,9 @@ whalo [2,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/query_tasks_special_rules/start.snap b/index-scheduler/src/snapshots/lib.rs/query_tasks_special_rules/start.snap index caab362d7..2bb4f7590 100644 --- a/index-scheduler/src/snapshots/lib.rs/query_tasks_special_rules/start.snap +++ b/index-scheduler/src/snapshots/lib.rs/query_tasks_special_rules/start.snap @@ -25,6 +25,9 @@ whalo [3,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/register/1.snap b/index-scheduler/src/snapshots/lib.rs/register/1.snap index 95eaa11c5..360752bc6 100644 --- a/index-scheduler/src/snapshots/lib.rs/register/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/register/1.snap @@ -24,6 +24,9 @@ doggo [3,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/swap_indexes/first_swap_processed.snap b/index-scheduler/src/snapshots/lib.rs/swap_indexes/first_swap_processed.snap index ec2c10e95..17e8936f0 100644 --- a/index-scheduler/src/snapshots/lib.rs/swap_indexes/first_swap_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/swap_indexes/first_swap_processed.snap @@ -29,6 +29,9 @@ d [2,4,] ---------------------------------------------------------------------- ### Index Mapper: ["a", "b", "c", "d"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/swap_indexes/initial_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/swap_indexes/initial_tasks_processed.snap index 073f280f3..b20b3b320 100644 --- a/index-scheduler/src/snapshots/lib.rs/swap_indexes/initial_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/swap_indexes/initial_tasks_processed.snap @@ -26,6 +26,9 @@ d [3,] ---------------------------------------------------------------------- ### Index Mapper: ["a", "b", "c", "d"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/swap_indexes/second_swap_processed.snap b/index-scheduler/src/snapshots/lib.rs/swap_indexes/second_swap_processed.snap index d820e04e6..acfbc4c77 100644 --- a/index-scheduler/src/snapshots/lib.rs/swap_indexes/second_swap_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/swap_indexes/second_swap_processed.snap @@ -29,6 +29,9 @@ d [2,4,] ---------------------------------------------------------------------- ### Index Mapper: ["a", "b", "c", "d"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/swap_indexes/third_empty_swap_processed.snap b/index-scheduler/src/snapshots/lib.rs/swap_indexes/third_empty_swap_processed.snap index 26bd1b0d3..c7c6faae6 100644 --- a/index-scheduler/src/snapshots/lib.rs/swap_indexes/third_empty_swap_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/swap_indexes/third_empty_swap_processed.snap @@ -30,6 +30,9 @@ d [2,4,] ---------------------------------------------------------------------- ### Index Mapper: ["a", "b", "c", "d"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/swap_indexes/two_swaps_registered.snap b/index-scheduler/src/snapshots/lib.rs/swap_indexes/two_swaps_registered.snap index c1472fdc8..0f8355f25 100644 --- a/index-scheduler/src/snapshots/lib.rs/swap_indexes/two_swaps_registered.snap +++ b/index-scheduler/src/snapshots/lib.rs/swap_indexes/two_swaps_registered.snap @@ -29,6 +29,9 @@ d [3,4,] ---------------------------------------------------------------------- ### Index Mapper: ["a", "b", "c", "d"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/first_swap_failed.snap b/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/first_swap_failed.snap index 3b98a429f..fd9790835 100644 --- a/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/first_swap_failed.snap +++ b/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/first_swap_failed.snap @@ -31,6 +31,9 @@ f [4,] ---------------------------------------------------------------------- ### Index Mapper: ["a", "b", "c", "d"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/initial_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/initial_tasks_processed.snap index 073f280f3..b20b3b320 100644 --- a/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/initial_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/swap_indexes_errors/initial_tasks_processed.snap @@ -26,6 +26,9 @@ d [3,] ---------------------------------------------------------------------- ### Index Mapper: ["a", "b", "c", "d"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_enqueued.snap index 162cffd2b..fc37dcf2d 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_enqueued.snap @@ -21,6 +21,9 @@ doggo [1,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap index c33926a04..e4c4d9d7e 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap @@ -22,6 +22,9 @@ doggo [1,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap index bbea9ff8b..6d5284f75 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap @@ -23,6 +23,9 @@ doggo [1,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [1,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_enqueued.snap index 162cffd2b..fc37dcf2d 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_enqueued.snap @@ -21,6 +21,9 @@ doggo [1,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap index c33926a04..e4c4d9d7e 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap @@ -22,6 +22,9 @@ doggo [1,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap index 3ae98f06f..78f62c086 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap @@ -22,6 +22,9 @@ doggo [1,] ---------------------------------------------------------------------- ### Index Mapper: ["catto"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [1,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/initial_tasks_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/initial_tasks_enqueued.snap index b22cad0ca..afb8af39c 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/initial_tasks_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/initial_tasks_enqueued.snap @@ -23,6 +23,9 @@ doggo [2,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap index acf3b752c..d2a8f671f 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap @@ -26,6 +26,9 @@ doggo [2,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap index f41fae458..a478dc57f 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap @@ -25,6 +25,9 @@ doggo [2,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap index 15638b4b4..1a00d5f3e 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap @@ -25,6 +25,9 @@ doggo [2,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/1.snap index 5a1d5e749..7daafcccb 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/1.snap @@ -31,6 +31,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,10,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/2.snap index 1fac082df..d112c8145 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index/2.snap @@ -31,6 +31,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,10,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/1.snap index ae959d293..83f17bcef 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/1.snap @@ -31,6 +31,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,10,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/2.snap index 6261c5f78..48f972785 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/2.snap @@ -31,6 +31,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,10,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/3.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/3.snap index f27170870..fc2fdc5f1 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/3.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_with_index_without_autobatching/3.snap @@ -31,6 +31,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,10,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/1.snap index a6e6954fa..828d4dafc 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/2.snap index 983bde528..9e24162a8 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/1.snap index 2f21c9ef2..671713c8e 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/2.snap index 40dfd4fd1..7d8225df7 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/3.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/3.snap index 9540e40bc..f28753015 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/3.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_cant_create_index_without_index_without_autobatching/3.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/1.snap index 1ea5cf1e6..ad5968b58 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/2.snap index 8a6eb23e9..87997bebd 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/3.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/3.snap index 88a3866a7..c2580f4bb 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/3.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_right_without_index_starts_with_cant_create/3.snap @@ -30,6 +30,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/1.snap index 83f67d737..61b7f3016 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/1.snap @@ -31,6 +31,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,10,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/2.snap index 09e43e490..0962dcdf5 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_addition_mixed_rights_with_index/2.snap @@ -31,6 +31,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,10,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_replace/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_replace/1.snap index 3ef17fe8a..a47ef319f 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_replace/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_replace/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_replace/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_replace/2.snap index 06c8fb066..f6423719c 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_replace/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_replace/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/1.snap index f37b613e8..0f52c9664 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/2.snap index 37aedde10..b1528c103 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/3.snap b/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/3.snap index 028ec3e0b..b80b8bb40 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/3.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_replace_without_autobatching/3.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_update/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_update/1.snap index cfaccc46f..6157fb454 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_update/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_update/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_update/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_update/2.snap index 68d640fea..736f998d0 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_update/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_update/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/1.snap b/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/1.snap index ceee17298..85fda1a43 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/2.snap b/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/2.snap index 62cb62c71..fb0b629ec 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/3.snap b/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/3.snap index ed9f09f93..a1fc55210 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/3.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_document_update_without_autobatching/3.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/1.snap b/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/1.snap index 2875c299c..330a3318e 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/1.snap @@ -28,6 +28,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: [] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/2.snap b/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/2.snap index 0f9af60e7..9fd990aa9 100644 --- a/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/test_mixed_document_addition/2.snap @@ -29,6 +29,9 @@ doggos [0,1,2,3,4,5,6,7,8,9,] ---------------------------------------------------------------------- ### Index Mapper: ["doggos"] +---------------------------------------------------------------------- +### Canceled By: + ---------------------------------------------------------------------- ### Enqueued At: [timestamp] [0,] diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index ac9f2e1a6..820e313a4 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -162,13 +162,14 @@ impl From
for DetailsView { #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TaskCommonQueryRaw { uids: Option>, + canceled_by: Option>, types: Option>>, statuses: Option>>, index_uids: Option>>, } impl TaskCommonQueryRaw { fn validate(self) -> Result { - let Self { uids, types, statuses, index_uids } = self; + let Self { uids, canceled_by, types, statuses, index_uids } = self; let uids = if let Some(uids) = uids { Some( uids.into_iter() @@ -182,6 +183,23 @@ impl TaskCommonQueryRaw { } else { None }; + let canceled_by = if let Some(canceled_by) = canceled_by { + Some( + canceled_by + .into_iter() + .map(|canceled_by_string| { + canceled_by_string.parse::().map_err(|_e| { + index_scheduler::Error::InvalidTaskCanceledBy { + canceled_by: canceled_by_string, + } + .into() + }) + }) + .collect::, ResponseError>>()?, + ) + } else { + None + }; let types = if let Some(types) = types.and_then(fold_star_or) as Option> { Some( @@ -235,7 +253,7 @@ impl TaskCommonQueryRaw { } else { None }; - Ok(TaskCommonQuery { types, uids, statuses, index_uids }) + Ok(TaskCommonQuery { types, uids, canceled_by, statuses, index_uids }) } } @@ -402,6 +420,7 @@ pub struct TaskDateQuery { pub struct TaskCommonQuery { types: Option>, uids: Option>, + canceled_by: Option>, statuses: Option>, index_uids: Option>, } @@ -427,7 +446,7 @@ async fn cancel_tasks( ) -> Result { let query = params.into_inner().validate()?; let TaskDeletionOrCancelationQuery { - common: TaskCommonQuery { types, uids, statuses, index_uids }, + common: TaskCommonQuery { types, uids, canceled_by, statuses, index_uids }, dates: TaskDateQuery { after_enqueued_at, @@ -446,6 +465,7 @@ async fn cancel_tasks( types, index_uids, uids, + canceled_by, before_enqueued_at, after_enqueued_at, before_started_at, @@ -478,7 +498,7 @@ async fn delete_tasks( params: web::Query, ) -> Result { let TaskDeletionOrCancelationQuery { - common: TaskCommonQuery { types, uids, statuses, index_uids }, + common: TaskCommonQuery { types, uids, canceled_by, statuses, index_uids }, dates: TaskDateQuery { after_enqueued_at, @@ -497,6 +517,7 @@ async fn delete_tasks( types, index_uids, uids, + canceled_by, after_enqueued_at, before_enqueued_at, after_started_at, @@ -538,7 +559,7 @@ async fn get_tasks( analytics: web::Data, ) -> Result { let TasksFilterQuery { - common: TaskCommonQuery { types, uids, statuses, index_uids }, + common: TaskCommonQuery { types, uids, canceled_by, statuses, index_uids }, limit, from, dates: @@ -572,6 +593,7 @@ async fn get_tasks( types, index_uids, uids, + canceled_by, before_enqueued_at, after_enqueued_at, before_started_at, From 2fdd814e5793be409bf2d9b78576577c060e2679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 8 Nov 2022 12:43:51 +0100 Subject: [PATCH 5/9] Update tests following task API changes --- meilisearch-http/tests/common/index.rs | 8 ++++---- meilisearch-http/tests/dumps/mod.rs | 18 ++++++++--------- meilisearch-http/tests/tasks/mod.rs | 27 +++++++++++++++++--------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/meilisearch-http/tests/common/index.rs b/meilisearch-http/tests/common/index.rs index 1ac56d9ad..6a488d8aa 100644 --- a/meilisearch-http/tests/common/index.rs +++ b/meilisearch-http/tests/common/index.rs @@ -106,17 +106,17 @@ impl Index<'_> { } pub async fn list_tasks(&self) -> (Value, StatusCode) { - let url = format!("/tasks?indexUid={}", self.uid); + let url = format!("/tasks?indexUids={}", self.uid); self.service.get(url).await } pub async fn filtered_tasks(&self, type_: &[&str], status: &[&str]) -> (Value, StatusCode) { - let mut url = format!("/tasks?indexUid={}", self.uid); + let mut url = format!("/tasks?indexUids={}", self.uid); if !type_.is_empty() { - let _ = write!(url, "&type={}", type_.join(",")); + let _ = write!(url, "&types={}", type_.join(",")); } if !status.is_empty() { - let _ = write!(url, "&status={}", status.join(",")); + let _ = write!(url, "&statuses={}", status.join(",")); } self.service.get(url).await } diff --git a/meilisearch-http/tests/dumps/mod.rs b/meilisearch-http/tests/dumps/mod.rs index 3f783a1e3..cd9ba3828 100644 --- a/meilisearch-http/tests/dumps/mod.rs +++ b/meilisearch-http/tests/dumps/mod.rs @@ -59,7 +59,7 @@ async fn import_dump_v2_movie_raw() { assert_eq!(code, 200); assert_eq!( tasks, - json!({ "results": [{"uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "duration": "PT41.751156S", "enqueuedAt": "2021-09-08T08:30:30.550282Z", "startedAt": "2021-09-08T08:30:30.553012Z", "finishedAt": "2021-09-08T08:31:12.304168Z" }], "limit": 20, "from": 0, "next": null }) + json!({ "results": [{"uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "error": null, "duration": "PT41.751156S", "enqueuedAt": "2021-09-08T08:30:30.550282Z", "startedAt": "2021-09-08T08:30:30.553012Z", "finishedAt": "2021-09-08T08:31:12.304168Z" }], "limit": 20, "from": 0, "next": null }) ); // finally we're just going to check that we can still get a few documents by id @@ -122,7 +122,7 @@ async fn import_dump_v2_movie_with_settings() { assert_eq!(code, 200); assert_eq!( tasks, - json!({ "results": [{ "uid": 1, "indexUid": "indexUID", "status": "succeeded", "type": "settingsUpdate", "details": { "displayedAttributes": ["title", "genres", "overview", "poster", "release_date"], "searchableAttributes": ["title", "overview"], "filterableAttributes": ["genres"], "stopWords": ["of", "the"] }, "duration": "PT37.488777S", "enqueuedAt": "2021-09-08T08:24:02.323444Z", "startedAt": "2021-09-08T08:24:02.324145Z", "finishedAt": "2021-09-08T08:24:39.812922Z" }, { "uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "duration": "PT39.941318S", "enqueuedAt": "2021-09-08T08:21:14.742672Z", "startedAt": "2021-09-08T08:21:14.750166Z", "finishedAt": "2021-09-08T08:21:54.691484Z" }], "limit": 20, "from": 1, "next": null }) + json!({ "results": [{ "uid": 1, "indexUid": "indexUID", "status": "succeeded", "type": "settingsUpdate", "canceledBy": null, "details": { "displayedAttributes": ["title", "genres", "overview", "poster", "release_date"], "searchableAttributes": ["title", "overview"], "filterableAttributes": ["genres"], "stopWords": ["of", "the"] }, "error": null, "duration": "PT37.488777S", "enqueuedAt": "2021-09-08T08:24:02.323444Z", "startedAt": "2021-09-08T08:24:02.324145Z", "finishedAt": "2021-09-08T08:24:39.812922Z" }, { "uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "error": null, "duration": "PT39.941318S", "enqueuedAt": "2021-09-08T08:21:14.742672Z", "startedAt": "2021-09-08T08:21:14.750166Z", "finishedAt": "2021-09-08T08:21:54.691484Z" }], "limit": 20, "from": 1, "next": null }) ); // finally we're just going to check that we can still get a few documents by id @@ -185,7 +185,7 @@ async fn import_dump_v2_rubygems_with_settings() { assert_eq!(code, 200); assert_eq!( tasks["results"][0], - json!({"uid": 92, "indexUid": "rubygems", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": {"receivedDocuments": 0, "indexedDocuments": 1042}, "duration": "PT14.034672S", "enqueuedAt": "2021-09-08T08:40:31.390775Z", "startedAt": "2021-09-08T08:51:39.060642Z", "finishedAt": "2021-09-08T08:51:53.095314Z"}) + json!({"uid": 92, "indexUid": "rubygems", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": {"receivedDocuments": 0, "indexedDocuments": 1042}, "error": null, "duration": "PT14.034672S", "enqueuedAt": "2021-09-08T08:40:31.390775Z", "startedAt": "2021-09-08T08:51:39.060642Z", "finishedAt": "2021-09-08T08:51:53.095314Z"}) ); // finally we're just going to check that we can still get a few documents by id @@ -246,7 +246,7 @@ async fn import_dump_v3_movie_raw() { assert_eq!(code, 200); assert_eq!( tasks, - json!({ "results": [{"uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "duration": "PT41.751156S", "enqueuedAt": "2021-09-08T08:30:30.550282Z", "startedAt": "2021-09-08T08:30:30.553012Z", "finishedAt": "2021-09-08T08:31:12.304168Z" }], "limit": 20, "from": 0, "next": null }) + json!({ "results": [{"uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "error": null, "duration": "PT41.751156S", "enqueuedAt": "2021-09-08T08:30:30.550282Z", "startedAt": "2021-09-08T08:30:30.553012Z", "finishedAt": "2021-09-08T08:31:12.304168Z" }], "limit": 20, "from": 0, "next": null }) ); // finally we're just going to check that we can still get a few documents by id @@ -309,7 +309,7 @@ async fn import_dump_v3_movie_with_settings() { assert_eq!(code, 200); assert_eq!( tasks, - json!({ "results": [{ "uid": 1, "indexUid": "indexUID", "status": "succeeded", "type": "settingsUpdate", "details": { "displayedAttributes": ["title", "genres", "overview", "poster", "release_date"], "searchableAttributes": ["title", "overview"], "filterableAttributes": ["genres"], "stopWords": ["of", "the"] }, "duration": "PT37.488777S", "enqueuedAt": "2021-09-08T08:24:02.323444Z", "startedAt": "2021-09-08T08:24:02.324145Z", "finishedAt": "2021-09-08T08:24:39.812922Z" }, { "uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "duration": "PT39.941318S", "enqueuedAt": "2021-09-08T08:21:14.742672Z", "startedAt": "2021-09-08T08:21:14.750166Z", "finishedAt": "2021-09-08T08:21:54.691484Z" }], "limit": 20, "from": 1, "next": null }) + json!({ "results": [{ "uid": 1, "indexUid": "indexUID", "status": "succeeded", "type": "settingsUpdate", "canceledBy": null, "details": { "displayedAttributes": ["title", "genres", "overview", "poster", "release_date"], "searchableAttributes": ["title", "overview"], "filterableAttributes": ["genres"], "stopWords": ["of", "the"] }, "error": null, "duration": "PT37.488777S", "enqueuedAt": "2021-09-08T08:24:02.323444Z", "startedAt": "2021-09-08T08:24:02.324145Z", "finishedAt": "2021-09-08T08:24:39.812922Z" }, { "uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "error": null, "duration": "PT39.941318S", "enqueuedAt": "2021-09-08T08:21:14.742672Z", "startedAt": "2021-09-08T08:21:14.750166Z", "finishedAt": "2021-09-08T08:21:54.691484Z" }], "limit": 20, "from": 1, "next": null }) ); // finally we're just going to check that we can["results"] still get a few documents by id @@ -372,7 +372,7 @@ async fn import_dump_v3_rubygems_with_settings() { assert_eq!(code, 200); assert_eq!( tasks["results"][0], - json!({"uid": 92, "indexUid": "rubygems", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": {"receivedDocuments": 0, "indexedDocuments": 1042}, "duration": "PT14.034672S", "enqueuedAt": "2021-09-08T08:40:31.390775Z", "startedAt": "2021-09-08T08:51:39.060642Z", "finishedAt": "2021-09-08T08:51:53.095314Z"}) + json!({"uid": 92, "indexUid": "rubygems", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": {"receivedDocuments": 0, "indexedDocuments": 1042}, "error": null, "duration": "PT14.034672S", "enqueuedAt": "2021-09-08T08:40:31.390775Z", "startedAt": "2021-09-08T08:51:39.060642Z", "finishedAt": "2021-09-08T08:51:53.095314Z"}) ); // finally we're just going to check that we can still get a few documents by id @@ -433,7 +433,7 @@ async fn import_dump_v4_movie_raw() { assert_eq!(code, 200); assert_eq!( tasks, - json!({ "results": [{"uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "duration": "PT41.751156S", "enqueuedAt": "2021-09-08T08:30:30.550282Z", "startedAt": "2021-09-08T08:30:30.553012Z", "finishedAt": "2021-09-08T08:31:12.304168Z" }], "limit" : 20, "from": 0, "next": null }) + json!({ "results": [{"uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "error": null, "duration": "PT41.751156S", "enqueuedAt": "2021-09-08T08:30:30.550282Z", "startedAt": "2021-09-08T08:30:30.553012Z", "finishedAt": "2021-09-08T08:31:12.304168Z" }], "limit" : 20, "from": 0, "next": null }) ); // finally we're just going to check that we can still get a few documents by id @@ -496,7 +496,7 @@ async fn import_dump_v4_movie_with_settings() { assert_eq!(code, 200); assert_eq!( tasks, - json!({ "results": [{ "uid": 1, "indexUid": "indexUID", "status": "succeeded", "type": "settingsUpdate", "details": { "displayedAttributes": ["title", "genres", "overview", "poster", "release_date"], "searchableAttributes": ["title", "overview"], "filterableAttributes": ["genres"], "stopWords": ["of", "the"] }, "duration": "PT37.488777S", "enqueuedAt": "2021-09-08T08:24:02.323444Z", "startedAt": "2021-09-08T08:24:02.324145Z", "finishedAt": "2021-09-08T08:24:39.812922Z" }, { "uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "duration": "PT39.941318S", "enqueuedAt": "2021-09-08T08:21:14.742672Z", "startedAt": "2021-09-08T08:21:14.750166Z", "finishedAt": "2021-09-08T08:21:54.691484Z" }], "limit": 20, "from": 1, "next": null }) + json!({ "results": [{ "uid": 1, "indexUid": "indexUID", "status": "succeeded", "type": "settingsUpdate", "canceledBy": null, "details": { "displayedAttributes": ["title", "genres", "overview", "poster", "release_date"], "searchableAttributes": ["title", "overview"], "filterableAttributes": ["genres"], "stopWords": ["of", "the"] }, "error": null, "duration": "PT37.488777S", "enqueuedAt": "2021-09-08T08:24:02.323444Z", "startedAt": "2021-09-08T08:24:02.324145Z", "finishedAt": "2021-09-08T08:24:39.812922Z" }, { "uid": 0, "indexUid": "indexUID", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": { "receivedDocuments": 0, "indexedDocuments": 31944 }, "error": null, "duration": "PT39.941318S", "enqueuedAt": "2021-09-08T08:21:14.742672Z", "startedAt": "2021-09-08T08:21:14.750166Z", "finishedAt": "2021-09-08T08:21:54.691484Z" }], "limit": 20, "from": 1, "next": null }) ); // finally we're just going to check that we can still get a few documents by id @@ -559,7 +559,7 @@ async fn import_dump_v4_rubygems_with_settings() { assert_eq!(code, 200); assert_eq!( tasks["results"][0], - json!({ "uid": 92, "indexUid": "rubygems", "status": "succeeded", "type": "documentAdditionOrUpdate", "details": {"receivedDocuments": 0, "indexedDocuments": 1042}, "duration": "PT14.034672S", "enqueuedAt": "2021-09-08T08:40:31.390775Z", "startedAt": "2021-09-08T08:51:39.060642Z", "finishedAt": "2021-09-08T08:51:53.095314Z"}) + json!({ "uid": 92, "indexUid": "rubygems", "status": "succeeded", "type": "documentAdditionOrUpdate", "canceledBy": null, "details": {"receivedDocuments": 0, "indexedDocuments": 1042}, "error": null, "duration": "PT14.034672S", "enqueuedAt": "2021-09-08T08:40:31.390775Z", "startedAt": "2021-09-08T08:51:39.060642Z", "finishedAt": "2021-09-08T08:51:53.095314Z"}) ); // finally we're just going to check that we can still get a few documents by id diff --git a/meilisearch-http/tests/tasks/mod.rs b/meilisearch-http/tests/tasks/mod.rs index 6a642617c..6dbfd1fb8 100644 --- a/meilisearch-http/tests/tasks/mod.rs +++ b/meilisearch-http/tests/tasks/mod.rs @@ -67,37 +67,37 @@ async fn list_tasks_with_star_filters() { index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) .await; - let (response, code) = index.service.get("/tasks?indexUid=test").await; + let (response, code) = index.service.get("/tasks?indexUids=test").await; assert_eq!(code, 200); assert_eq!(response["results"].as_array().unwrap().len(), 2); - let (response, code) = index.service.get("/tasks?indexUid=*").await; + let (response, code) = index.service.get("/tasks?indexUids=*").await; assert_eq!(code, 200); assert_eq!(response["results"].as_array().unwrap().len(), 2); - let (response, code) = index.service.get("/tasks?indexUid=*,pasteque").await; + let (response, code) = index.service.get("/tasks?indexUids=*,pasteque").await; assert_eq!(code, 200); assert_eq!(response["results"].as_array().unwrap().len(), 2); - let (response, code) = index.service.get("/tasks?type=*").await; + let (response, code) = index.service.get("/tasks?types=*").await; assert_eq!(code, 200); assert_eq!(response["results"].as_array().unwrap().len(), 2); let (response, code) = - index.service.get("/tasks?type=*,documentAdditionOrUpdate&status=*").await; + index.service.get("/tasks?types=*,documentAdditionOrUpdate&statuses=*").await; assert_eq!(code, 200, "{:?}", response); assert_eq!(response["results"].as_array().unwrap().len(), 2); let (response, code) = index .service - .get("/tasks?type=*,documentAdditionOrUpdate&status=*,failed&indexUid=test") + .get("/tasks?types=*,documentAdditionOrUpdate&statuses=*,failed&indexUids=test") .await; assert_eq!(code, 200, "{:?}", response); assert_eq!(response["results"].as_array().unwrap().len(), 2); let (response, code) = index .service - .get("/tasks?type=*,documentAdditionOrUpdate&status=*,failed&indexUid=test,*") + .get("/tasks?types=*,documentAdditionOrUpdate&statuses=*,failed&indexUids=test,*") .await; assert_eq!(code, 200, "{:?}", response); assert_eq!(response["results"].as_array().unwrap().len(), 2); @@ -231,10 +231,12 @@ async fn test_summarized_document_addition_or_update() { "indexUid": "test", "status": "succeeded", "type": "documentAdditionOrUpdate", + "canceledBy": null, "details": { "receivedDocuments": 1, "indexedDocuments": 1 }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -253,10 +255,12 @@ async fn test_summarized_document_addition_or_update() { "indexUid": "test", "status": "succeeded", "type": "documentAdditionOrUpdate", + "canceledBy": null, "details": { "receivedDocuments": 1, "indexedDocuments": 1 }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -512,6 +516,7 @@ async fn test_summarized_index_deletion() { "indexUid": "test", "status": "failed", "type": "indexDeletion", + "canceledBy": null, "error": { "message": "Index `test` not found.", "code": "index_not_found", @@ -538,9 +543,11 @@ async fn test_summarized_index_deletion() { "indexUid": "test", "status": "succeeded", "type": "indexDeletion", + "canceledBy": null, "details": { "deletedDocuments": 1 }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -560,9 +567,11 @@ async fn test_summarized_index_deletion() { "indexUid": "test", "status": "succeeded", "type": "indexDeletion", + "canceledBy": null, "details": { "deletedDocuments": 1 }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -759,7 +768,7 @@ async fn test_summarized_task_cancelation() { // to avoid being flaky we're only going to cancel an already finished task :( index.create(None).await; index.wait_task(0).await; - server.cancel_task(json!({ "uid": [0] })).await; + server.cancel_task(json!({ "uids": [0] })).await; index.wait_task(1).await; let (task, _) = index.get_task(1).await; assert_json_snapshot!(task, @@ -790,7 +799,7 @@ async fn test_summarized_task_deletion() { // to avoid being flaky we're only going to delete an already finished task :( index.create(None).await; index.wait_task(0).await; - server.delete_task(json!({ "uid": [0] })).await; + server.delete_task(json!({ "uids": [0] })).await; index.wait_task(1).await; let (task, _) = index.get_task(1).await; assert_json_snapshot!(task, From 6126fc8d984f587a665e9e577081a3e948c09708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 8 Nov 2022 12:52:05 +0100 Subject: [PATCH 6/9] Rename original_query to original_filters everywhere --- index-scheduler/src/batch.rs | 4 +-- index-scheduler/src/insta_snapshot.rs | 8 +++--- .../cancel_processed.snap | 2 +- .../initial_tasks_enqueued.snap | 2 +- .../cancel_mix_of_tasks/cancel_processed.snap | 2 +- ...rocessing_second_task_cancel_enqueued.snap | 2 +- .../cancel_processed.snap | 2 +- .../cancel_task_registered.snap | 2 +- .../cancel_processed.snap | 2 +- .../lib.rs/query_tasks_canceled_by/start.snap | 2 +- .../task_deletion_processed.snap | 4 +-- .../task_deletion_processed.snap | 2 +- .../task_deletion_done.snap | 2 +- .../task_deletion_enqueued.snap | 2 +- .../task_deletion_processing.snap | 2 +- index-scheduler/src/utils.rs | 12 ++++++--- meilisearch-http/src/routes/tasks.rs | 26 ++++++++++--------- meilisearch-http/tests/tasks/mod.rs | 6 +++-- meilisearch-types/src/tasks.rs | 22 ++++++++-------- 19 files changed, 57 insertions(+), 49 deletions(-) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index 85b9b41d4..8a2e956cd 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -535,7 +535,7 @@ impl IndexScheduler { Some(Details::TaskCancelation { matched_tasks: _, canceled_tasks, - original_query: _, + original_filters: _, }) => { *canceled_tasks = Some(canceled_tasks_content_uuids.len() as u64); } @@ -579,7 +579,7 @@ impl IndexScheduler { Some(Details::TaskDeletion { matched_tasks: _, deleted_tasks, - original_query: _, + original_filters: _, }) => { *deleted_tasks = Some(deleted_tasks_count); } diff --git a/index-scheduler/src/insta_snapshot.rs b/index-scheduler/src/insta_snapshot.rs index 84e1c257f..206704f51 100644 --- a/index-scheduler/src/insta_snapshot.rs +++ b/index-scheduler/src/insta_snapshot.rs @@ -184,16 +184,16 @@ fn snapshot_details(d: &Details) -> String { Details::TaskCancelation { matched_tasks, canceled_tasks, - original_query, + original_filters, } => { - format!("{{ matched_tasks: {matched_tasks:?}, canceled_tasks: {canceled_tasks:?}, original_query: {original_query:?} }}") + format!("{{ matched_tasks: {matched_tasks:?}, canceled_tasks: {canceled_tasks:?}, original_filters: {original_filters:?} }}") } Details::TaskDeletion { matched_tasks, deleted_tasks, - original_query, + original_filters, } => { - format!("{{ matched_tasks: {matched_tasks:?}, deleted_tasks: {deleted_tasks:?}, original_query: {original_query:?} }}") + format!("{{ matched_tasks: {matched_tasks:?}, deleted_tasks: {deleted_tasks:?}, original_filters: {original_filters:?} }}") }, Details::Dump { dump_uid } => { format!("{{ dump_uid: {dump_uid:?} }}") diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap index ef9a54f9c..397f44a54 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/cancel_processed.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 0 {uid: 0, status: canceled, canceled_by: 1, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} -1 {uid: 1, status: succeeded, details: { matched_tasks: 1, canceled_tasks: Some(1), original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} +1 {uid: 1, status: succeeded, details: { matched_tasks: 1, canceled_tasks: Some(1), original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: enqueued [] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap index 5bbb74c82..87ee28ca3 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_enqueued_task/initial_tasks_enqueued.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 0 {uid: 0, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} -1 {uid: 1, status: enqueued, details: { matched_tasks: 1, canceled_tasks: None, original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} +1 {uid: 1, status: enqueued, details: { matched_tasks: 1, canceled_tasks: None, original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: enqueued [0,1,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap index 42f4ce8fa..78b82bc6c 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/cancel_processed.snap @@ -9,7 +9,7 @@ source: index-scheduler/src/lib.rs 0 {uid: 0, status: succeeded, details: { received_documents: 1, indexed_documents: Some(1) }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} 1 {uid: 1, status: canceled, canceled_by: 3, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "beavero", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} 2 {uid: 2, status: canceled, canceled_by: 3, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "wolfo", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000002, documents_count: 1, allow_index_creation: true }} -3 {uid: 3, status: succeeded, details: { matched_tasks: 3, canceled_tasks: Some(2), original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0, 1, 2]> }} +3 {uid: 3, status: succeeded, details: { matched_tasks: 3, canceled_tasks: Some(2), original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0, 1, 2]> }} ---------------------------------------------------------------------- ### Status: enqueued [] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap index 194567da1..40f4b4f9f 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_mix_of_tasks/processing_second_task_cancel_enqueued.snap @@ -9,7 +9,7 @@ source: index-scheduler/src/lib.rs 0 {uid: 0, status: succeeded, details: { received_documents: 1, indexed_documents: Some(1) }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} 1 {uid: 1, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "beavero", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} 2 {uid: 2, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "wolfo", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000002, documents_count: 1, allow_index_creation: true }} -3 {uid: 3, status: enqueued, details: { matched_tasks: 3, canceled_tasks: None, original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0, 1, 2]> }} +3 {uid: 3, status: enqueued, details: { matched_tasks: 3, canceled_tasks: None, original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0, 1, 2]> }} ---------------------------------------------------------------------- ### Status: enqueued [1,2,3,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap index 237eed237..2fb773425 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_processed.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 0 {uid: 0, status: canceled, canceled_by: 1, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} -1 {uid: 1, status: succeeded, details: { matched_tasks: 1, canceled_tasks: Some(1), original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} +1 {uid: 1, status: succeeded, details: { matched_tasks: 1, canceled_tasks: Some(1), original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: enqueued [] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_task_registered.snap b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_task_registered.snap index 335511562..611f55957 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_task_registered.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_processing_task/cancel_task_registered.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 0 {uid: 0, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} -1 {uid: 1, status: enqueued, details: { matched_tasks: 1, canceled_tasks: None, original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} +1 {uid: 1, status: enqueued, details: { matched_tasks: 1, canceled_tasks: None, original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: enqueued [0,1,] diff --git a/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap b/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap index 68ed945a8..e7f95a20f 100644 --- a/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/cancel_succeeded_task/cancel_processed.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 0 {uid: 0, status: succeeded, details: { received_documents: 1, indexed_documents: Some(1) }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} -1 {uid: 1, status: succeeded, details: { matched_tasks: 1, canceled_tasks: Some(0), original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} +1 {uid: 1, status: succeeded, details: { matched_tasks: 1, canceled_tasks: Some(0), original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: enqueued [] diff --git a/index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap b/index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap index d4d934e5f..5fa8f6da6 100644 --- a/index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap +++ b/index-scheduler/src/snapshots/lib.rs/query_tasks_canceled_by/start.snap @@ -9,7 +9,7 @@ source: index-scheduler/src/lib.rs 0 {uid: 0, status: succeeded, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }} 1 {uid: 1, status: canceled, canceled_by: 3, details: { primary_key: Some("sheep") }, kind: IndexCreation { index_uid: "doggo", primary_key: Some("sheep") }} 2 {uid: 2, status: canceled, canceled_by: 3, details: { swaps: [IndexSwap { indexes: ("catto", "doggo") }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("catto", "doggo") }] }} -3 {uid: 3, status: succeeded, details: { matched_tasks: 3, canceled_tasks: Some(0), original_query: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0, 1, 2]> }} +3 {uid: 3, status: succeeded, details: { matched_tasks: 3, canceled_tasks: Some(0), original_filters: "test_query" }, kind: TaskCancelation { query: "test_query", tasks: RoaringBitmap<[0, 1, 2]> }} ---------------------------------------------------------------------- ### Status: enqueued [] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap index 6d5284f75..5b38dd7a5 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/task_deletion_processed.snap @@ -7,8 +7,8 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 1 {uid: 1, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} -2 {uid: 2, status: succeeded, details: { matched_tasks: 1, deleted_tasks: Some(1), original_query: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0]> }} -3 {uid: 3, status: succeeded, details: { matched_tasks: 1, deleted_tasks: Some(0), original_query: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0]> }} +2 {uid: 2, status: succeeded, details: { matched_tasks: 1, deleted_tasks: Some(1), original_filters: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0]> }} +3 {uid: 3, status: succeeded, details: { matched_tasks: 1, deleted_tasks: Some(0), original_filters: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: enqueued [1,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap index 78f62c086..07b9479f8 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/task_deletion_processed.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 1 {uid: 1, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} -2 {uid: 2, status: succeeded, details: { matched_tasks: 1, deleted_tasks: Some(1), original_query: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0]> }} +2 {uid: 2, status: succeeded, details: { matched_tasks: 1, deleted_tasks: Some(1), original_filters: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0]> }} ---------------------------------------------------------------------- ### Status: enqueued [1,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap index d2a8f671f..893c17c5a 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_done.snap @@ -9,7 +9,7 @@ source: index-scheduler/src/lib.rs 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: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} 2 {uid: 2, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} -3 {uid: 3, status: succeeded, details: { matched_tasks: 2, deleted_tasks: Some(0), original_query: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0, 1]> }} +3 {uid: 3, status: succeeded, details: { matched_tasks: 2, deleted_tasks: Some(0), original_filters: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0, 1]> }} ---------------------------------------------------------------------- ### Status: enqueued [0,1,2,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap index a478dc57f..c9bab9a04 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_enqueued.snap @@ -9,7 +9,7 @@ source: index-scheduler/src/lib.rs 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: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} 2 {uid: 2, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} -3 {uid: 3, status: enqueued, details: { matched_tasks: 2, deleted_tasks: None, original_query: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0, 1]> }} +3 {uid: 3, status: enqueued, details: { matched_tasks: 2, deleted_tasks: None, original_filters: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0, 1]> }} ---------------------------------------------------------------------- ### Status: enqueued [0,1,2,3,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap index 1a00d5f3e..0716464cb 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_undeleteable/task_deletion_processing.snap @@ -9,7 +9,7 @@ source: index-scheduler/src/lib.rs 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: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} 2 {uid: 2, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentAdditionOrUpdate { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} -3 {uid: 3, status: enqueued, details: { matched_tasks: 2, deleted_tasks: None, original_query: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0, 1]> }} +3 {uid: 3, status: enqueued, details: { matched_tasks: 2, deleted_tasks: None, original_filters: "test_query" }, kind: TaskDeletion { query: "test_query", tasks: RoaringBitmap<[0, 1]> }} ---------------------------------------------------------------------- ### Status: enqueued [0,1,2,3,] diff --git a/index-scheduler/src/utils.rs b/index-scheduler/src/utils.rs index 71869d1fd..1effa7cf8 100644 --- a/index-scheduler/src/utils.rs +++ b/index-scheduler/src/utils.rs @@ -451,13 +451,17 @@ impl IndexScheduler { assert_ne!(status, Status::Succeeded); } } - Details::TaskCancelation { matched_tasks, canceled_tasks, original_query } => { + Details::TaskCancelation { + matched_tasks, + canceled_tasks, + original_filters, + } => { if let Some(canceled_tasks) = canceled_tasks { assert_eq!(status, Status::Succeeded); assert!(canceled_tasks <= matched_tasks); match &kind { KindWithContent::TaskCancelation { query, tasks } => { - assert_eq!(query, &original_query); + assert_eq!(query, &original_filters); assert_eq!(tasks.len(), matched_tasks); } _ => panic!(), @@ -466,13 +470,13 @@ impl IndexScheduler { assert_ne!(status, Status::Succeeded); } } - Details::TaskDeletion { matched_tasks, deleted_tasks, original_query } => { + Details::TaskDeletion { matched_tasks, deleted_tasks, original_filters } => { if let Some(deleted_tasks) = deleted_tasks { assert_eq!(status, Status::Succeeded); assert!(deleted_tasks <= matched_tasks); match &kind { KindWithContent::TaskDeletion { query, tasks } => { - assert_eq!(query, &original_query); + assert_eq!(query, &original_filters); assert_eq!(tasks.len(), matched_tasks); } _ => panic!(), diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index 820e313a4..42e8d9c85 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -134,20 +134,22 @@ impl From
for DetailsView { Details::ClearAll { deleted_documents } => { DetailsView { deleted_documents: Some(deleted_documents), ..DetailsView::default() } } - Details::TaskCancelation { matched_tasks, canceled_tasks, original_query } => { + Details::TaskCancelation { matched_tasks, canceled_tasks, original_filters } => { DetailsView { matched_tasks: Some(matched_tasks), canceled_tasks: Some(canceled_tasks), - original_filters: Some(original_query), + original_filters: Some(original_filters), + ..DetailsView::default() + } + } + Details::TaskDeletion { matched_tasks, deleted_tasks, original_filters } => { + DetailsView { + matched_tasks: Some(matched_tasks), + deleted_tasks: Some(deleted_tasks), + original_filters: Some(original_filters), ..DetailsView::default() } } - Details::TaskDeletion { matched_tasks, deleted_tasks, original_query } => DetailsView { - matched_tasks: Some(matched_tasks), - deleted_tasks: Some(deleted_tasks), - original_filters: Some(original_query), - ..DetailsView::default() - }, Details::Dump { dump_uid } => { DetailsView { dump_uid: Some(dump_uid), ..DetailsView::default() } } @@ -876,7 +878,7 @@ mod tests { .unwrap() .validate() .unwrap_err(); - snapshot!(format!("{err}"), @"Task status `finished` is invalid. Available task statuses are `enqueued`, `processing`, `succeeded`, `failed`, `canceled`"); + snapshot!(format!("{err}"), @"Task status `finished` is invalid. Available task statuses are `enqueued`, `processing`, `succeeded`, `failed`, `canceled`."); } } #[test] @@ -948,7 +950,7 @@ mod tests { let json = r#" { "from": 12, "limit": 15, "indexUids": "toto,tata-78", "statuses": "succeeded,enqueued", "afterEnqueuedAt": "2012-04-23", "uids": "1,2,3" }"#; let query = serde_json::from_str::(json).unwrap().validate().unwrap(); - snapshot!(format!("{:?}", query), @r###"TasksFilterQuery { limit: 15, from: Some(12), common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), statuses: Some([Succeeded, Enqueued]), index_uids: Some(["toto", "tata-78"]) }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"###); + snapshot!(format!("{:?}", query), @r###"TasksFilterQuery { limit: 15, from: Some(12), common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), canceled_by: None, statuses: Some([Succeeded, Enqueued]), index_uids: Some(["toto", "tata-78"]) }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"###); } { // Stars should translate to `None` in the query @@ -956,7 +958,7 @@ mod tests { let json = r#" { "indexUids": "*", "statuses": "succeeded,*", "afterEnqueuedAt": "2012-04-23", "uids": "1,2,3" }"#; let query = serde_json::from_str::(json).unwrap().validate().unwrap(); - snapshot!(format!("{:?}", query), @"TasksFilterQuery { limit: 20, from: None, common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), statuses: None, index_uids: None }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"); + snapshot!(format!("{:?}", query), @"TasksFilterQuery { limit: 20, from: None, common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), canceled_by: None, statuses: None, index_uids: None }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"); } { // Stars should also translate to `None` in task deletion/cancelation queries @@ -965,7 +967,7 @@ mod tests { .unwrap() .validate() .unwrap(); - snapshot!(format!("{:?}", query), @"TaskDeletionOrCancelationQuery { common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), statuses: None, index_uids: None }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"); + snapshot!(format!("{:?}", query), @"TaskDeletionOrCancelationQuery { common: TaskCommonQuery { types: None, uids: Some([1, 2, 3]), canceled_by: None, statuses: None, index_uids: None }, dates: TaskDateQuery { after_enqueued_at: Some(2012-04-24 0:00:00.0 +00:00:00), before_enqueued_at: None, after_started_at: None, before_started_at: None, after_finished_at: None, before_finished_at: None } }"); } { // Stars in uids not allowed diff --git a/meilisearch-http/tests/tasks/mod.rs b/meilisearch-http/tests/tasks/mod.rs index 6dbfd1fb8..85b4f84b7 100644 --- a/meilisearch-http/tests/tasks/mod.rs +++ b/meilisearch-http/tests/tasks/mod.rs @@ -779,11 +779,13 @@ async fn test_summarized_task_cancelation() { "indexUid": null, "status": "succeeded", "type": "taskCancelation", + "canceledBy": null, "details": { "matchedTasks": 1, "canceledTasks": 0, - "originalQuery": "uid=0" + "originalFilters": "uids=0" }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -813,7 +815,7 @@ async fn test_summarized_task_deletion() { "details": { "matchedTasks": 1, "deletedTasks": 1, - "originalQuery": "uid=0" + "originalFilters": "uid=0" }, "duration": "[duration]", "enqueuedAt": "[date]", diff --git a/meilisearch-types/src/tasks.rs b/meilisearch-types/src/tasks.rs index af9a4d537..fa6673e84 100644 --- a/meilisearch-types/src/tasks.rs +++ b/meilisearch-types/src/tasks.rs @@ -217,12 +217,12 @@ impl KindWithContent { KindWithContent::TaskCancelation { query, tasks } => Some(Details::TaskCancelation { matched_tasks: tasks.len(), canceled_tasks: None, - original_query: query.clone(), + original_filters: query.clone(), }), KindWithContent::TaskDeletion { query, tasks } => Some(Details::TaskDeletion { matched_tasks: tasks.len(), deleted_tasks: None, - original_query: query.clone(), + original_filters: query.clone(), }), KindWithContent::DumpCreation { .. } => None, KindWithContent::SnapshotCreation => None, @@ -260,12 +260,12 @@ impl KindWithContent { KindWithContent::TaskCancelation { query, tasks } => Some(Details::TaskCancelation { matched_tasks: tasks.len(), canceled_tasks: Some(0), - original_query: query.clone(), + original_filters: query.clone(), }), KindWithContent::TaskDeletion { query, tasks } => Some(Details::TaskDeletion { matched_tasks: tasks.len(), deleted_tasks: Some(0), - original_query: query.clone(), + original_filters: query.clone(), }), KindWithContent::DumpCreation { .. } => None, KindWithContent::SnapshotCreation => None, @@ -298,12 +298,12 @@ impl From<&KindWithContent> for Option
{ KindWithContent::TaskCancelation { query, tasks } => Some(Details::TaskCancelation { matched_tasks: tasks.len(), canceled_tasks: None, - original_query: query.clone(), + original_filters: query.clone(), }), KindWithContent::TaskDeletion { query, tasks } => Some(Details::TaskDeletion { matched_tasks: tasks.len(), deleted_tasks: None, - original_query: query.clone(), + original_filters: query.clone(), }), KindWithContent::DumpCreation { dump_uid, .. } => { Some(Details::Dump { dump_uid: dump_uid.clone() }) @@ -468,8 +468,8 @@ pub enum Details { IndexInfo { primary_key: Option }, DocumentDeletion { matched_documents: usize, deleted_documents: Option }, ClearAll { deleted_documents: Option }, - TaskCancelation { matched_tasks: u64, canceled_tasks: Option, original_query: String }, - TaskDeletion { matched_tasks: u64, deleted_tasks: Option, original_query: String }, + TaskCancelation { matched_tasks: u64, canceled_tasks: Option, original_filters: String }, + TaskDeletion { matched_tasks: u64, deleted_tasks: Option, original_filters: String }, Dump { dump_uid: String }, IndexSwap { swaps: Vec }, } @@ -536,11 +536,11 @@ mod tests { let details = Details::TaskDeletion { matched_tasks: 1, deleted_tasks: None, - original_query: "hello".to_owned(), + original_filters: "hello".to_owned(), }; let serialised = SerdeJson::
::bytes_encode(&details).unwrap(); let deserialised = SerdeJson::
::bytes_decode(&serialised).unwrap(); - meili_snap::snapshot!(format!("{:?}", details), @r###"TaskDeletion { matched_tasks: 1, deleted_tasks: None, original_query: "hello" }"###); - meili_snap::snapshot!(format!("{:?}", deserialised), @r###"TaskDeletion { matched_tasks: 1, deleted_tasks: None, original_query: "hello" }"###); + meili_snap::snapshot!(format!("{:?}", details), @r###"TaskDeletion { matched_tasks: 1, deleted_tasks: None, original_filters: "hello" }"###); + meili_snap::snapshot!(format!("{:?}", deserialised), @r###"TaskDeletion { matched_tasks: 1, deleted_tasks: None, original_filters: "hello" }"###); } } From 1e464e87fc3bdf458fe2663db0414d729f618934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 8 Nov 2022 13:39:52 +0100 Subject: [PATCH 7/9] Update more insta-snap tests --- meilisearch-http/tests/tasks/mod.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/meilisearch-http/tests/tasks/mod.rs b/meilisearch-http/tests/tasks/mod.rs index 85b4f84b7..145bb1b01 100644 --- a/meilisearch-http/tests/tasks/mod.rs +++ b/meilisearch-http/tests/tasks/mod.rs @@ -284,6 +284,7 @@ async fn test_summarized_delete_batch() { "indexUid": "test", "status": "failed", "type": "documentDeletion", + "canceledBy": null, "details": { "matchedDocuments": 3, "deletedDocuments": null @@ -313,10 +314,12 @@ async fn test_summarized_delete_batch() { "indexUid": "test", "status": "succeeded", "type": "documentDeletion", + "canceledBy": null, "details": { "matchedDocuments": 1, "deletedDocuments": 0 }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -340,6 +343,7 @@ async fn test_summarized_delete_document() { "indexUid": "test", "status": "failed", "type": "documentDeletion", + "canceledBy": null, "details": { "matchedDocuments": 1, "deletedDocuments": null @@ -369,10 +373,12 @@ async fn test_summarized_delete_document() { "indexUid": "test", "status": "succeeded", "type": "documentDeletion", + "canceledBy": null, "details": { "matchedDocuments": 1, "deletedDocuments": 0 }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -398,6 +404,7 @@ async fn test_summarized_settings_update() { "indexUid": "test", "status": "failed", "type": "settingsUpdate", + "canceledBy": null, "details": { "rankingRules": [ "custom" @@ -427,6 +434,7 @@ async fn test_summarized_settings_update() { "indexUid": "test", "status": "succeeded", "type": "settingsUpdate", + "canceledBy": null, "details": { "displayedAttributes": [ "doggos", @@ -440,6 +448,7 @@ async fn test_summarized_settings_update() { "iq" ] }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -463,9 +472,11 @@ async fn test_summarized_index_creation() { "indexUid": "test", "status": "succeeded", "type": "indexCreation", + "canceledBy": null, "details": { "primaryKey": null }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -484,6 +495,7 @@ async fn test_summarized_index_creation() { "indexUid": "test", "status": "failed", "type": "indexCreation", + "canceledBy": null, "details": { "primaryKey": "doggos" }, @@ -596,6 +608,7 @@ async fn test_summarized_index_update() { "indexUid": "test", "status": "failed", "type": "indexUpdate", + "canceledBy": null, "details": { "primaryKey": null }, @@ -623,6 +636,7 @@ async fn test_summarized_index_update() { "indexUid": "test", "status": "failed", "type": "indexUpdate", + "canceledBy": null, "details": { "primaryKey": "bones" }, @@ -653,9 +667,11 @@ async fn test_summarized_index_update() { "indexUid": "test", "status": "succeeded", "type": "indexUpdate", + "canceledBy": null, "details": { "primaryKey": null }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -674,9 +690,11 @@ async fn test_summarized_index_update() { "indexUid": "test", "status": "succeeded", "type": "indexUpdate", + "canceledBy": null, "details": { "primaryKey": "bones" }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -703,6 +721,7 @@ async fn test_summarized_index_swap() { "indexUid": null, "status": "failed", "type": "indexSwap", + "canceledBy": null, "details": { "swaps": [ { @@ -743,6 +762,7 @@ async fn test_summarized_index_swap() { "indexUid": null, "status": "succeeded", "type": "indexSwap", + "canceledBy": null, "details": { "swaps": [ { @@ -753,6 +773,7 @@ async fn test_summarized_index_swap() { } ] }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -812,11 +833,13 @@ async fn test_summarized_task_deletion() { "indexUid": null, "status": "succeeded", "type": "taskDeletion", + "canceledBy": null, "details": { "matchedTasks": 1, "deletedTasks": 1, - "originalFilters": "uid=0" + "originalFilters": "uids=0" }, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", @@ -839,6 +862,8 @@ async fn test_summarized_dump_creation() { "indexUid": null, "status": "succeeded", "type": "dumpCreation", + "canceledBy": null, + "error": null, "duration": "[duration]", "enqueuedAt": "[date]", "startedAt": "[date]", From f5454dfa6007b6837d294e61d83acf481faea9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 8 Nov 2022 15:31:08 +0100 Subject: [PATCH 8/9] Make clippy happy They're a happy clip now. --- meilisearch-http/src/routes/tasks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index 42e8d9c85..9cd263b47 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -693,7 +693,7 @@ pub(crate) mod date_deserializer { DeserializeDateOption::Before => Ok(datetime), DeserializeDateOption::After => { let datetime = - datetime.checked_add(Duration::days(1)).unwrap_or_else(|| datetime); + datetime.checked_add(Duration::days(1)).unwrap_or(datetime); Ok(datetime) } } From 52b38bee9d79aab25827e28590dc97d901d3f2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 8 Nov 2022 15:45:53 +0100 Subject: [PATCH 9/9] Make rustfmt happy >:-( --- meilisearch-http/src/routes/tasks.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index 9cd263b47..71c774672 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -17,7 +17,6 @@ use time::{Duration, OffsetDateTime}; use tokio::task; use self::date_deserializer::{deserialize_date, DeserializeDateOption}; - use super::{fold_star_or, SummarizedTaskView}; use crate::analytics::Analytics; use crate::extractors::authentication::policies::*; @@ -692,8 +691,7 @@ pub(crate) mod date_deserializer { match option { DeserializeDateOption::Before => Ok(datetime), DeserializeDateOption::After => { - let datetime = - datetime.checked_add(Duration::days(1)).unwrap_or(datetime); + let datetime = datetime.checked_add(Duration::days(1)).unwrap_or(datetime); Ok(datetime) } }