Skip to content

Commit

Permalink
refactor: add RemoteCompaction error (#4251)
Browse files Browse the repository at this point in the history
* refactor: make location field public

* refactor: add RemoteCompaction error
  • Loading branch information
zyy17 authored Jul 2, 2024
1 parent ef5d1a6 commit fd4a928
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/mito2/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use store_api::storage::RegionId;

use crate::cache::file_cache::FileType;
use crate::region::RegionState;
use crate::schedule::remote_job_scheduler::JobId;
use crate::sst::file::FileId;
use crate::worker::WorkerId;

Expand Down Expand Up @@ -768,6 +769,20 @@ pub enum Error {
#[snafu(implicit)]
location: Location,
},

#[snafu(display(
"Failed to remotely compact region {} by job {} due to {}",
region_id,
job_id,
reason
))]
RemoteCompaction {
region_id: RegionId,
job_id: JobId,
reason: String,
#[snafu(implicit)]
location: Location,
},
}

pub type Result<T, E = Error> = std::result::Result<T, E>;
Expand Down Expand Up @@ -888,6 +903,7 @@ impl ErrorExt for Error {
TimeRangePredicateOverflow { .. } => StatusCode::InvalidArguments,
BuildTimeRangeFilter { .. } => StatusCode::Unexpected,
UnsupportedOperation { .. } => StatusCode::Unsupported,
RemoteCompaction { .. } => StatusCode::Unexpected,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/mito2/src/schedule/remote_job_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub trait RemoteJobScheduler: Send + Sync + 'static {
#[snafu(display("Internal error occurred in remote job scheduler: {}", reason))]
pub struct RemoteJobSchedulerError {
#[snafu(implicit)]
location: Location,
pub location: Location,
pub reason: String,
// Keep the waiters in the error so that we can notify them when fallback to the local compaction.
pub waiters: Vec<OutputTx>,
Expand Down

0 comments on commit fd4a928

Please sign in to comment.