Skip to content

Commit

Permalink
chore: apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Oct 17, 2023
1 parent e5ee291 commit 009c445
Show file tree
Hide file tree
Showing 11 changed files with 199 additions and 164 deletions.
9 changes: 1 addition & 8 deletions src/cmd/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ pub enum Error {
source: common_procedure::error::Error,
},

#[snafu(display("Failed to start procedures"))]
RecoverProcedures {
location: Location,
source: common_procedure::error::Error,
},

#[snafu(display("Failed to start datanode"))]
StartDatanode {
location: Location,
Expand Down Expand Up @@ -229,8 +223,7 @@ impl ErrorExt for Error {
| Error::CreateDir { .. }
| Error::ConnectEtcd { .. } => StatusCode::InvalidArguments,
Error::StartProcedureManager { source, .. }
| Error::StopProcedureManager { source, .. }
| Error::RecoverProcedures { source, .. } => source.status_code(),
| Error::StopProcedureManager { source, .. } => source.status_code(),
Error::ReplCreation { .. } | Error::Readline { .. } => StatusCode::Internal,
Error::RequestDatabase { source, .. } => source.status_code(),
Error::CollectRecordBatches { source, .. }
Expand Down
12 changes: 4 additions & 8 deletions src/cmd/src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ use servers::Mode;
use snafu::ResultExt;

use crate::error::{
CreateDirSnafu, IllegalConfigSnafu, InitMetadataSnafu, RecoverProceduresSnafu, Result,
ShutdownDatanodeSnafu, ShutdownFrontendSnafu, StartDatanodeSnafu, StartFrontendSnafu,
StartProcedureManagerSnafu, StopProcedureManagerSnafu,
CreateDirSnafu, IllegalConfigSnafu, InitMetadataSnafu, Result, ShutdownDatanodeSnafu,
ShutdownFrontendSnafu, StartDatanodeSnafu, StartFrontendSnafu, StartProcedureManagerSnafu,
StopProcedureManagerSnafu,
};
use crate::options::{MixOptions, Options, TopLevelOptions};

Expand Down Expand Up @@ -172,12 +172,8 @@ impl Instance {

self.procedure_manager
.start()
.context(StartProcedureManagerSnafu)?;

self.procedure_manager
.recover()
.await
.context(RecoverProceduresSnafu)?;
.context(StartProcedureManagerSnafu)?;

self.frontend.start().await.context(StartFrontendSnafu)?;
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/common/procedure/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub enum Error {
LoaderConflict { name: String, location: Location },

#[snafu(display("Procedure Manager is stopped"))]
ProcedureManagerNotStart { location: Location },
ManagerNotStart { location: Location },

#[snafu(display("Failed to serialize to json"))]
ToJson {
Expand Down Expand Up @@ -152,7 +152,7 @@ impl ErrorExt for Error {
| Error::RetryTimesExceeded { .. }
| Error::RetryLater { .. }
| Error::WaitWatcher { .. }
| Error::ProcedureManagerNotStart { .. } => StatusCode::Internal,
| Error::ManagerNotStart { .. } => StatusCode::Internal,
Error::LoaderConflict { .. } | Error::DuplicateProcedure { .. } => {
StatusCode::InvalidArguments
}
Expand Down
Loading

0 comments on commit 009c445

Please sign in to comment.