mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-04 12:27:43 +00:00
add Error test, fix clippy
This commit is contained in:
@@ -6,7 +6,7 @@ use rustfs_rio::Reader;
|
||||
use super::Erasure;
|
||||
use crate::disk::error::Error;
|
||||
use crate::disk::error_reduce::count_errs;
|
||||
use crate::disk::error_reduce::{reduce_write_quorum_errs, OBJECT_OP_IGNORED_ERRS};
|
||||
use crate::disk::error_reduce::{OBJECT_OP_IGNORED_ERRS, reduce_write_quorum_errs};
|
||||
use std::sync::Arc;
|
||||
use std::vec;
|
||||
use tokio::sync::mpsc;
|
||||
@@ -62,15 +62,12 @@ impl<'a> MultiWriter<'a> {
|
||||
}
|
||||
|
||||
if let Some(write_err) = reduce_write_quorum_errs(&self.errs, OBJECT_OP_IGNORED_ERRS, self.write_quorum) {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
format!(
|
||||
"Failed to write data: {} (offline-disks={}/{})",
|
||||
write_err,
|
||||
count_errs(&self.errs, &Error::DiskNotFound),
|
||||
self.writers.len()
|
||||
),
|
||||
));
|
||||
return Err(std::io::Error::other(format!(
|
||||
"Failed to write data: {} (offline-disks={}/{})",
|
||||
write_err,
|
||||
count_errs(&self.errs, &Error::DiskNotFound),
|
||||
self.writers.len()
|
||||
)));
|
||||
}
|
||||
|
||||
Err(std::io::Error::other(format!(
|
||||
@@ -103,10 +100,7 @@ impl Erasure {
|
||||
total += n;
|
||||
let res = self.encode_data(&buf[..n])?;
|
||||
if let Err(err) = tx.send(res).await {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
format!("Failed to send encoded data : {}", err),
|
||||
));
|
||||
return Err(std::io::Error::other(format!("Failed to send encoded data : {}", err)));
|
||||
}
|
||||
}
|
||||
Ok(_) => break,
|
||||
|
||||
@@ -3,7 +3,6 @@ use reed_solomon_erasure::galois_8::ReedSolomon;
|
||||
// use rustfs_rio::Reader;
|
||||
use smallvec::SmallVec;
|
||||
use std::io;
|
||||
use std::io::ErrorKind;
|
||||
use tracing::error;
|
||||
use tracing::warn;
|
||||
use uuid::Uuid;
|
||||
@@ -98,7 +97,7 @@ impl Erasure {
|
||||
if let Some(encoder) = self.encoder.as_ref() {
|
||||
encoder.encode(data_slices).map_err(|e| {
|
||||
error!("encode data error: {:?}", e);
|
||||
io::Error::new(ErrorKind::Other, format!("encode data error {:?}", e))
|
||||
io::Error::other(format!("encode data error {:?}", e))
|
||||
})?;
|
||||
} else {
|
||||
warn!("parity_shards > 0, but encoder is None");
|
||||
@@ -129,7 +128,7 @@ impl Erasure {
|
||||
if let Some(encoder) = self.encoder.as_ref() {
|
||||
encoder.reconstruct(shards).map_err(|e| {
|
||||
error!("decode data error: {:?}", e);
|
||||
io::Error::new(ErrorKind::Other, format!("decode data error {:?}", e))
|
||||
io::Error::other(format!("decode data error {:?}", e))
|
||||
})?;
|
||||
} else {
|
||||
warn!("parity_shards > 0, but encoder is None");
|
||||
|
||||
Reference in New Issue
Block a user