mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
Remove the IndexRename operation
This commit is contained in:
parent
5fa214abb1
commit
9e8242c57d
@ -36,9 +36,6 @@ pub enum BatchKind {
|
|||||||
IndexUpdate {
|
IndexUpdate {
|
||||||
id: TaskId,
|
id: TaskId,
|
||||||
},
|
},
|
||||||
IndexRename {
|
|
||||||
id: TaskId,
|
|
||||||
},
|
|
||||||
IndexSwap {
|
IndexSwap {
|
||||||
id: TaskId,
|
id: TaskId,
|
||||||
},
|
},
|
||||||
@ -51,7 +48,6 @@ impl BatchKind {
|
|||||||
Kind::IndexCreation => (BatchKind::IndexCreation { id: task_id }, true),
|
Kind::IndexCreation => (BatchKind::IndexCreation { id: task_id }, true),
|
||||||
Kind::IndexDeletion => (BatchKind::IndexDeletion { ids: vec![task_id] }, true),
|
Kind::IndexDeletion => (BatchKind::IndexDeletion { ids: vec![task_id] }, true),
|
||||||
Kind::IndexUpdate => (BatchKind::IndexUpdate { id: task_id }, true),
|
Kind::IndexUpdate => (BatchKind::IndexUpdate { id: task_id }, true),
|
||||||
Kind::IndexRename => (BatchKind::IndexRename { id: task_id }, true),
|
|
||||||
Kind::IndexSwap => (BatchKind::IndexSwap { id: task_id }, true),
|
Kind::IndexSwap => (BatchKind::IndexSwap { id: task_id }, true),
|
||||||
Kind::DocumentClear => (BatchKind::DocumentClear { ids: vec![task_id] }, false),
|
Kind::DocumentClear => (BatchKind::DocumentClear { ids: vec![task_id] }, false),
|
||||||
Kind::DocumentAddition => (
|
Kind::DocumentAddition => (
|
||||||
@ -89,10 +85,9 @@ impl BatchKind {
|
|||||||
fn accumulate(self, id: TaskId, kind: Kind) -> ControlFlow<Self, Self> {
|
fn accumulate(self, id: TaskId, kind: Kind) -> ControlFlow<Self, Self> {
|
||||||
match (self, kind) {
|
match (self, kind) {
|
||||||
// We don't batch any of these operations
|
// We don't batch any of these operations
|
||||||
(
|
(this, Kind::IndexCreation | Kind::IndexUpdate | Kind::IndexSwap) => {
|
||||||
this,
|
ControlFlow::Break(this)
|
||||||
Kind::IndexCreation | Kind::IndexRename | Kind::IndexUpdate | Kind::IndexSwap,
|
}
|
||||||
) => ControlFlow::Break(this),
|
|
||||||
// The index deletion can batch with everything but must stop after
|
// The index deletion can batch with everything but must stop after
|
||||||
(
|
(
|
||||||
BatchKind::DocumentClear { mut ids }
|
BatchKind::DocumentClear { mut ids }
|
||||||
@ -335,7 +330,6 @@ impl BatchKind {
|
|||||||
BatchKind::IndexCreation { .. }
|
BatchKind::IndexCreation { .. }
|
||||||
| BatchKind::IndexDeletion { .. }
|
| BatchKind::IndexDeletion { .. }
|
||||||
| BatchKind::IndexUpdate { .. }
|
| BatchKind::IndexUpdate { .. }
|
||||||
| BatchKind::IndexRename { .. }
|
|
||||||
| BatchKind::IndexSwap { .. },
|
| BatchKind::IndexSwap { .. },
|
||||||
_,
|
_,
|
||||||
) => {
|
) => {
|
||||||
@ -414,10 +408,6 @@ mod tests {
|
|||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, IndexUpdate]), @"Some(DocumentImport { method: UpdateDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, IndexUpdate]), @"Some(DocumentImport { method: UpdateDocuments, import_ids: [0] })");
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentDeletion, IndexUpdate]), @"Some(DocumentDeletion { deletion_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentDeletion, IndexUpdate]), @"Some(DocumentDeletion { deletion_ids: [0] })");
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, IndexRename]), @"Some(DocumentImport { method: ReplaceDocuments, import_ids: [0] })");
|
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, IndexRename]), @"Some(DocumentImport { method: UpdateDocuments, import_ids: [0] })");
|
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentDeletion, IndexRename]), @"Some(DocumentDeletion { deletion_ids: [0] })");
|
|
||||||
|
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, IndexSwap]), @"Some(DocumentImport { method: ReplaceDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, IndexSwap]), @"Some(DocumentImport { method: ReplaceDocuments, import_ids: [0] })");
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, IndexSwap]), @"Some(DocumentImport { method: UpdateDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, IndexSwap]), @"Some(DocumentImport { method: UpdateDocuments, import_ids: [0] })");
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentDeletion, IndexSwap]), @"Some(DocumentDeletion { deletion_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentDeletion, IndexSwap]), @"Some(DocumentDeletion { deletion_ids: [0] })");
|
||||||
@ -446,8 +436,6 @@ mod tests {
|
|||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, Settings, IndexCreation]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: UpdateDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, Settings, IndexCreation]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: UpdateDocuments, import_ids: [0] })");
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, Settings, IndexUpdate]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: ReplaceDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, Settings, IndexUpdate]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: ReplaceDocuments, import_ids: [0] })");
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, Settings, IndexUpdate]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: UpdateDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, Settings, IndexUpdate]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: UpdateDocuments, import_ids: [0] })");
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, Settings, IndexRename]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: ReplaceDocuments, import_ids: [0] })");
|
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, Settings, IndexRename]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: UpdateDocuments, import_ids: [0] })");
|
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, Settings, IndexSwap]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: ReplaceDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentAddition, Settings, IndexSwap]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: ReplaceDocuments, import_ids: [0] })");
|
||||||
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, Settings, IndexSwap]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: UpdateDocuments, import_ids: [0] })");
|
assert_smol_debug_snapshot!(autobatch_from([DocumentUpdate, Settings, IndexSwap]), @"Some(SettingsAndDocumentImport { settings_ids: [1], method: UpdateDocuments, import_ids: [0] })");
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,6 @@ impl IndexScheduler {
|
|||||||
tasks: self.get_existing_tasks(rtxn, ids)?,
|
tasks: self.get_existing_tasks(rtxn, ids)?,
|
||||||
})),
|
})),
|
||||||
BatchKind::IndexSwap { id: _ } => todo!(),
|
BatchKind::IndexSwap { id: _ } => todo!(),
|
||||||
BatchKind::IndexRename { id: _ } => todo!(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,10 +158,6 @@ pub enum KindWithContent {
|
|||||||
index_uid: String,
|
index_uid: String,
|
||||||
primary_key: Option<String>,
|
primary_key: Option<String>,
|
||||||
},
|
},
|
||||||
IndexRename {
|
|
||||||
index_uid: String,
|
|
||||||
new_name: String,
|
|
||||||
},
|
|
||||||
IndexSwap {
|
IndexSwap {
|
||||||
lhs: String,
|
lhs: String,
|
||||||
rhs: String,
|
rhs: String,
|
||||||
@ -193,7 +189,6 @@ impl KindWithContent {
|
|||||||
KindWithContent::IndexCreation { .. } => Kind::IndexCreation,
|
KindWithContent::IndexCreation { .. } => Kind::IndexCreation,
|
||||||
KindWithContent::IndexDeletion { .. } => Kind::IndexDeletion,
|
KindWithContent::IndexDeletion { .. } => Kind::IndexDeletion,
|
||||||
KindWithContent::IndexUpdate { .. } => Kind::IndexUpdate,
|
KindWithContent::IndexUpdate { .. } => Kind::IndexUpdate,
|
||||||
KindWithContent::IndexRename { .. } => Kind::IndexRename,
|
|
||||||
KindWithContent::IndexSwap { .. } => Kind::IndexSwap,
|
KindWithContent::IndexSwap { .. } => Kind::IndexSwap,
|
||||||
KindWithContent::CancelTask { .. } => Kind::CancelTask,
|
KindWithContent::CancelTask { .. } => Kind::CancelTask,
|
||||||
KindWithContent::DumpExport { .. } => Kind::DumpExport,
|
KindWithContent::DumpExport { .. } => Kind::DumpExport,
|
||||||
@ -216,7 +211,6 @@ impl KindWithContent {
|
|||||||
| IndexCreation { .. }
|
| IndexCreation { .. }
|
||||||
| IndexDeletion { .. }
|
| IndexDeletion { .. }
|
||||||
| IndexUpdate { .. }
|
| IndexUpdate { .. }
|
||||||
| IndexRename { .. }
|
|
||||||
| IndexSwap { .. }
|
| IndexSwap { .. }
|
||||||
| CancelTask { .. }
|
| CancelTask { .. }
|
||||||
| DumpExport { .. }
|
| DumpExport { .. }
|
||||||
@ -239,7 +233,6 @@ impl KindWithContent {
|
|||||||
| Settings { .. }
|
| Settings { .. }
|
||||||
| IndexDeletion { .. }
|
| IndexDeletion { .. }
|
||||||
| IndexUpdate { .. }
|
| IndexUpdate { .. }
|
||||||
| IndexRename { .. }
|
|
||||||
| IndexSwap { .. }
|
| IndexSwap { .. }
|
||||||
| CancelTask { .. }
|
| CancelTask { .. }
|
||||||
| DumpExport { .. }
|
| DumpExport { .. }
|
||||||
@ -259,11 +252,7 @@ impl KindWithContent {
|
|||||||
| IndexCreation { index_uid, .. }
|
| IndexCreation { index_uid, .. }
|
||||||
| IndexUpdate { index_uid, .. }
|
| IndexUpdate { index_uid, .. }
|
||||||
| IndexDeletion { index_uid } => Some(vec![index_uid]),
|
| IndexDeletion { index_uid } => Some(vec![index_uid]),
|
||||||
IndexRename {
|
IndexSwap { lhs, rhs } => Some(vec![lhs, rhs]),
|
||||||
index_uid: lhs,
|
|
||||||
new_name: rhs,
|
|
||||||
}
|
|
||||||
| IndexSwap { lhs, rhs } => Some(vec![lhs, rhs]),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -279,7 +268,6 @@ pub enum Kind {
|
|||||||
IndexCreation,
|
IndexCreation,
|
||||||
IndexDeletion,
|
IndexDeletion,
|
||||||
IndexUpdate,
|
IndexUpdate,
|
||||||
IndexRename,
|
|
||||||
IndexSwap,
|
IndexSwap,
|
||||||
CancelTask,
|
CancelTask,
|
||||||
DumpExport,
|
DumpExport,
|
||||||
@ -299,7 +287,6 @@ impl FromStr for Kind {
|
|||||||
"index_creation" => Ok(Kind::IndexCreation),
|
"index_creation" => Ok(Kind::IndexCreation),
|
||||||
"index_deletion" => Ok(Kind::IndexDeletion),
|
"index_deletion" => Ok(Kind::IndexDeletion),
|
||||||
"index_update" => Ok(Kind::IndexUpdate),
|
"index_update" => Ok(Kind::IndexUpdate),
|
||||||
"index_rename" => Ok(Kind::IndexRename),
|
|
||||||
"index_swap" => Ok(Kind::IndexSwap),
|
"index_swap" => Ok(Kind::IndexSwap),
|
||||||
"cancel_task" => Ok(Kind::CancelTask),
|
"cancel_task" => Ok(Kind::CancelTask),
|
||||||
"dump_export" => Ok(Kind::DumpExport),
|
"dump_export" => Ok(Kind::DumpExport),
|
||||||
|
Loading…
Reference in New Issue
Block a user