Skip to content

Commit

Permalink
refactor(storage): remove unused FlushIo variant (GreptimeTeam#1002)
Browse files Browse the repository at this point in the history
refactor(storeage): remove unused FlushIo variant
  • Loading branch information
etolbakov authored Feb 15, 2023
1 parent 374acc8 commit 4d82767
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions src/storage/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ pub enum Error {
backtrace: Backtrace,
},

#[snafu(display("Failed to write columns, source: {}", source))]
FlushIo {
source: object_store::Error,
backtrace: Backtrace,
},

#[snafu(display("Failed to write parquet file, source: {}", source))]
WriteParquet {
source: parquet::errors::ParquetError,
Expand Down Expand Up @@ -466,8 +460,7 @@ impl ErrorExt for Error {
| EncodeArrow { .. }
| ParseSchema { .. } => StatusCode::Unexpected,

FlushIo { .. }
| WriteParquet { .. }
WriteParquet { .. }
| ReadObject { .. }
| WriteObject { .. }
| ListObjects { .. }
Expand Down Expand Up @@ -530,27 +523,6 @@ mod tests {
assert!(err.backtrace_opt().is_some());
}

#[test]
pub fn test_flush_error() {
fn throw_io_error() -> std::result::Result<(), std::io::Error> {
Err(std::io::Error::new(
std::io::ErrorKind::UnexpectedEof,
"writer is closed",
))
}

let error = throw_io_error()
.map_err(|err| {
object_store::Error::new(object_store::ErrorKind::Unexpected, "writer close failed")
.set_source(err)
})
.context(FlushIoSnafu)
.err()
.unwrap();
assert_eq!(StatusCode::StorageUnavailable, error.status_code());
assert!(error.backtrace_opt().is_some());
}

#[test]
pub fn test_arrow_error() {
fn throw_arrow_error() -> std::result::Result<(), ArrowError> {
Expand Down

0 comments on commit 4d82767

Please sign in to comment.