refactor: add RemoteCompaction error (#4251)

* refactor: make location field public

* refactor: add RemoteCompaction error
This commit is contained in:
zyy17
2024-07-02 20:33:57 +08:00
committed by GitHub
parent ef5d1a6a65
commit fd4a928521
2 changed files with 17 additions and 1 deletions

View File

@@ -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;
@@ -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>;
@@ -888,6 +903,7 @@ impl ErrorExt for Error {
TimeRangePredicateOverflow { .. } => StatusCode::InvalidArguments,
BuildTimeRangeFilter { .. } => StatusCode::Unexpected,
UnsupportedOperation { .. } => StatusCode::Unsupported,
RemoteCompaction { .. } => StatusCode::Unexpected,
}
}

View File

@@ -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>,