mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-24 03:25:43 +08:00
Compare commits
No commits in common. "8ed39f5de0339a6b5f8b2f72386c161a8dd44d44" and "4224edea28bc66e8de30d6ad69cdab5aaa922335" have entirely different histories.
8ed39f5de0
...
4224edea28
@ -127,8 +127,8 @@ pub enum Error {
|
|||||||
_ => format!("{error}")
|
_ => format!("{error}")
|
||||||
})]
|
})]
|
||||||
Milli { error: milli::Error, index_uid: Option<String> },
|
Milli { error: milli::Error, index_uid: Option<String> },
|
||||||
#[error("An unexpected crash occurred when processing the task: {0}")]
|
#[error("An unexpected crash occurred when processing the task.")]
|
||||||
ProcessBatchPanicked(String),
|
ProcessBatchPanicked,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
FileStore(#[from] file_store::Error),
|
FileStore(#[from] file_store::Error),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
@ -196,7 +196,7 @@ impl Error {
|
|||||||
| Error::Dump(_)
|
| Error::Dump(_)
|
||||||
| Error::Heed(_)
|
| Error::Heed(_)
|
||||||
| Error::Milli { .. }
|
| Error::Milli { .. }
|
||||||
| Error::ProcessBatchPanicked(_)
|
| Error::ProcessBatchPanicked
|
||||||
| Error::FileStore(_)
|
| Error::FileStore(_)
|
||||||
| Error::IoError(_)
|
| Error::IoError(_)
|
||||||
| Error::Persist(_)
|
| Error::Persist(_)
|
||||||
@ -257,7 +257,7 @@ impl ErrorCode for Error {
|
|||||||
Error::NoSpaceLeftInTaskQueue => Code::NoSpaceLeftOnDevice,
|
Error::NoSpaceLeftInTaskQueue => Code::NoSpaceLeftOnDevice,
|
||||||
Error::Dump(e) => e.error_code(),
|
Error::Dump(e) => e.error_code(),
|
||||||
Error::Milli { error, .. } => error.error_code(),
|
Error::Milli { error, .. } => error.error_code(),
|
||||||
Error::ProcessBatchPanicked(_) => Code::Internal,
|
Error::ProcessBatchPanicked => Code::Internal,
|
||||||
Error::Heed(e) => e.error_code(),
|
Error::Heed(e) => e.error_code(),
|
||||||
Error::HeedTransaction(e) => e.error_code(),
|
Error::HeedTransaction(e) => e.error_code(),
|
||||||
Error::FileStore(e) => e.error_code(),
|
Error::FileStore(e) => e.error_code(),
|
||||||
|
@ -166,41 +166,13 @@ impl IndexScheduler {
|
|||||||
let processing_batch = &mut processing_batch;
|
let processing_batch = &mut processing_batch;
|
||||||
let progress = progress.clone();
|
let progress = progress.clone();
|
||||||
std::thread::scope(|s| {
|
std::thread::scope(|s| {
|
||||||
let p = progress.clone();
|
|
||||||
let handle = std::thread::Builder::new()
|
let handle = std::thread::Builder::new()
|
||||||
.name(String::from("batch-operation"))
|
.name(String::from("batch-operation"))
|
||||||
.spawn_scoped(s, move || {
|
.spawn_scoped(s, move || {
|
||||||
cloned_index_scheduler.process_batch(batch, processing_batch, p)
|
cloned_index_scheduler.process_batch(batch, processing_batch, progress)
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
handle.join().unwrap_or(Err(Error::ProcessBatchPanicked))
|
||||||
match handle.join() {
|
|
||||||
Ok(ret) => {
|
|
||||||
if ret.is_err() {
|
|
||||||
if let Ok(progress_view) =
|
|
||||||
serde_json::to_string(&progress.as_progress_view())
|
|
||||||
{
|
|
||||||
tracing::warn!("Batch failed while doing: {progress_view}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret
|
|
||||||
}
|
|
||||||
Err(panic) => {
|
|
||||||
if let Ok(progress_view) =
|
|
||||||
serde_json::to_string(&progress.as_progress_view())
|
|
||||||
{
|
|
||||||
tracing::warn!("Batch failed while doing: {progress_view}")
|
|
||||||
}
|
|
||||||
let msg = match panic.downcast_ref::<&'static str>() {
|
|
||||||
Some(s) => *s,
|
|
||||||
None => match panic.downcast_ref::<String>() {
|
|
||||||
Some(s) => &s[..],
|
|
||||||
None => "Box<dyn Any>",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
Err(Error::ProcessBatchPanicked(msg.to_string()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -326,17 +326,8 @@ impl IndexScheduler {
|
|||||||
match ret {
|
match ret {
|
||||||
Ok(Ok(())) => (),
|
Ok(Ok(())) => (),
|
||||||
Ok(Err(e)) => return Err(Error::DatabaseUpgrade(Box::new(e))),
|
Ok(Err(e)) => return Err(Error::DatabaseUpgrade(Box::new(e))),
|
||||||
Err(e) => {
|
Err(_e) => {
|
||||||
let msg = match e.downcast_ref::<&'static str>() {
|
return Err(Error::DatabaseUpgrade(Box::new(Error::ProcessBatchPanicked)));
|
||||||
Some(s) => *s,
|
|
||||||
None => match e.downcast_ref::<String>() {
|
|
||||||
Some(s) => &s[..],
|
|
||||||
None => "Box<dyn Any>",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return Err(Error::DatabaseUpgrade(Box::new(Error::ProcessBatchPanicked(
|
|
||||||
msg.to_string(),
|
|
||||||
))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ snapshot_kind: text
|
|||||||
[]
|
[]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### All Tasks:
|
### All Tasks:
|
||||||
0 {uid: 0, batch_uid: 0, status: failed, error: ResponseError { code: 200, message: "An unexpected crash occurred when processing the task: simulated panic", error_code: "internal", error_type: "internal", error_link: "https://docs.meilisearch.com/errors#internal" }, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
0 {uid: 0, batch_uid: 0, status: failed, error: ResponseError { code: 200, message: "An unexpected crash occurred when processing the task.", error_code: "internal", error_type: "internal", error_link: "https://docs.meilisearch.com/errors#internal" }, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Status:
|
### Status:
|
||||||
enqueued []
|
enqueued []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user