mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-06-02 18:25:35 +00:00
Improve the error message by categorizing NoSpaceLeftOnDevice
This commit is contained in:
parent
5607802fe1
commit
72c506d8f6
@ -411,7 +411,7 @@ impl ErrorCode for milli::Error {
|
||||
| UserError::DocumentLimitReached
|
||||
| UserError::UnknownInternalDocumentId { .. } => Code::Internal,
|
||||
UserError::InvalidStoreFile => Code::InvalidStoreFile,
|
||||
UserError::NoSpaceLeftOnDevice => Code::NoSpaceLeftOnDevice,
|
||||
UserError::NoSpaceLeftOnDevice { .. } => Code::NoSpaceLeftOnDevice,
|
||||
UserError::MaxDatabaseSizeReached => Code::DatabaseSizeLimitReached,
|
||||
UserError::AttributeLimitReached => Code::MaxFieldsLimitExceeded,
|
||||
UserError::InvalidFilter(_) => Code::InvalidSearchFilter,
|
||||
|
@ -259,8 +259,8 @@ and can not be more than 511 bytes.", .document_id.to_string()
|
||||
NoPrimaryKeyCandidateFound,
|
||||
#[error("The primary key inference failed as the engine found {} fields ending with `id` in their names: '{}' and '{}'. Please specify the primary key manually using the `primaryKey` query parameter.", .candidates.len(), .candidates.first().unwrap(), .candidates.get(1).unwrap())]
|
||||
MultiplePrimaryKeyCandidatesFound { candidates: Vec<String> },
|
||||
#[error("There is no more space left on the device. Consider increasing the size of the disk/partition.")]
|
||||
NoSpaceLeftOnDevice,
|
||||
#[error("There is no more space left on the device ({source_}). Consider increasing the size of the disk/partition.")]
|
||||
NoSpaceLeftOnDevice { source_: &'static str },
|
||||
#[error("Index already has a primary key: `{0}`.")]
|
||||
PrimaryKeyCannotBeChanged(String),
|
||||
#[error(transparent)]
|
||||
|
@ -417,25 +417,33 @@ fn spill_entry_to_sorter(
|
||||
deladd_buffer.clear();
|
||||
let mut value_writer = KvWriterDelAdd::new(deladd_buffer);
|
||||
|
||||
fn convert_io_to_user_error(error: io::Error) -> crate::Error {
|
||||
if error.kind() == io::ErrorKind::StorageFull {
|
||||
crate::Error::UserError(crate::UserError::NoSpaceLeftOnDevice { source_: "grenad" })
|
||||
} else {
|
||||
crate::Error::IoError(error)
|
||||
}
|
||||
}
|
||||
|
||||
match deladd {
|
||||
DelAddRoaringBitmap { del: Some(del), add: None } => {
|
||||
cbo_buffer.clear();
|
||||
CboRoaringBitmapCodec::serialize_into_vec(&del, cbo_buffer);
|
||||
value_writer.insert(DelAdd::Deletion, &cbo_buffer)?;
|
||||
value_writer.insert(DelAdd::Deletion, &cbo_buffer).map_err(convert_io_to_user_error)?;
|
||||
}
|
||||
DelAddRoaringBitmap { del: None, add: Some(add) } => {
|
||||
cbo_buffer.clear();
|
||||
CboRoaringBitmapCodec::serialize_into_vec(&add, cbo_buffer);
|
||||
value_writer.insert(DelAdd::Addition, &cbo_buffer)?;
|
||||
value_writer.insert(DelAdd::Addition, &cbo_buffer).map_err(convert_io_to_user_error)?;
|
||||
}
|
||||
DelAddRoaringBitmap { del: Some(del), add: Some(add) } => {
|
||||
cbo_buffer.clear();
|
||||
CboRoaringBitmapCodec::serialize_into_vec(&del, cbo_buffer);
|
||||
value_writer.insert(DelAdd::Deletion, &cbo_buffer)?;
|
||||
value_writer.insert(DelAdd::Deletion, &cbo_buffer).map_err(convert_io_to_user_error)?;
|
||||
|
||||
cbo_buffer.clear();
|
||||
CboRoaringBitmapCodec::serialize_into_vec(&add, cbo_buffer);
|
||||
value_writer.insert(DelAdd::Addition, &cbo_buffer)?;
|
||||
value_writer.insert(DelAdd::Addition, &cbo_buffer).map_err(convert_io_to_user_error)?;
|
||||
}
|
||||
DelAddRoaringBitmap { del: None, add: None } => return Ok(()),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user