Skip to content

Commit

Permalink
feat: skip peer available check by default
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Dec 29, 2023
1 parent e95e2b7 commit 0ad8aad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
6 changes: 1 addition & 5 deletions src/meta-srv/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ use crate::pubsub::Message;
#[snafu(visibility(pub))]
#[stack_trace_debug]
pub enum Error {
#[snafu(display("The target peer is unavailable temporally: {}", peer_id))]
PeerUnavailable { location: Location, peer_id: u64 },

#[snafu(display("Another migration procedure is running for region: {}", region_id))]
MigrationRunning {
location: Location,
Expand Down Expand Up @@ -653,8 +650,7 @@ impl ErrorExt for Error {
| Error::Join { .. }
| Error::WeightArray { .. }
| Error::NotSetWeightArray { .. }
| Error::Unsupported { .. }
| Error::PeerUnavailable { .. } => StatusCode::Internal,
| Error::Unsupported { .. } => StatusCode::Internal,
Error::TableAlreadyExists { .. } => StatusCode::TableAlreadyExists,
Error::EmptyKey { .. }
| Error::MissingRequiredParameter { .. }
Expand Down
30 changes: 17 additions & 13 deletions src/meta-srv/src/service/admin/region_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ use std::num::ParseIntError;
use std::str::FromStr;
use std::sync::Arc;

use common_meta::peer::Peer;
use common_meta::ClusterId;
use serde::Serialize;
use snafu::{OptionExt, ResultExt};
use snafu::ResultExt;
use store_api::storage::RegionId;
use tonic::codegen::http;

Expand Down Expand Up @@ -110,18 +111,21 @@ impl SubmitRegionMigrationTaskHandler {
to_peer_id,
} = task;

let from_peer = self.peer_lookup.peer(cluster_id, from_peer_id).context(
error::PeerUnavailableSnafu {
peer_id: from_peer_id,
},
)?;

let to_peer =
self.peer_lookup
.peer(cluster_id, to_peer_id)
.context(error::PeerUnavailableSnafu {
peer_id: to_peer_id,
})?;
let from_peer = self
.peer_lookup
.peer(cluster_id, from_peer_id)
.unwrap_or_else(|| Peer {
id: from_peer_id,
addr: String::new(),
});

let to_peer = self
.peer_lookup
.peer(cluster_id, to_peer_id)
.unwrap_or_else(|| Peer {
id: to_peer_id,
addr: String::new(),
});

let procedure_id = self
.region_migration_manager
Expand Down

0 comments on commit 0ad8aad

Please sign in to comment.