Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions components/error_code/src/raftstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define_error_codes!(
DATA_IS_NOT_READY => ("DataIsNotReady", "", ""),
DEADLINE_EXCEEDED => ("DeadlineExceeded", "", ""),
PENDING_PREPARE_MERGE => ("PendingPrepareMerge", "", ""),
RECOVERY_IN_PROGRESS => ("RecoveryInProgress", "", ""),

SNAP_ABORT => ("SnapAbort", "", ""),
SNAP_TOO_MANY => ("SnapTooMany", "", ""),
Expand Down Expand Up @@ -60,6 +61,8 @@ impl ErrorCodeExt for errorpb::Error {
PROPOSAL_IN_MERGING_MODE
} else if self.has_data_is_not_ready() {
DATA_IS_NOT_READY
} else if self.has_recovery_in_progress() {
RECOVERY_IN_PROGRESS
} else {
UNKNOWN
}
Expand Down
4 changes: 2 additions & 2 deletions components/pd_client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ impl PdClient for RpcClient {
fn store_heartbeat(
&self,
mut stats: pdpb::StoreStats,
report_opt: Option<pdpb::StoreReport>,
store_report: Option<pdpb::StoreReport>,
dr_autosync_status: Option<StoreDrAutoSyncStatus>,
) -> PdFuture<pdpb::StoreHeartbeatResponse> {
let timer = Instant::now();
Expand All @@ -730,7 +730,7 @@ impl PdClient for RpcClient {
.mut_interval()
.set_end_timestamp(UnixSecs::now().into_inner());
req.set_stats(stats);
if let Some(report) = report_opt {
if let Some(report) = store_report {
req.set_store_report(report);
}
if let Some(status) = dr_autosync_status {
Expand Down
2 changes: 2 additions & 0 deletions components/pd_client/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ impl PdConnector {
let addr_trim = trim_http_prefix(addr);
let channel = {
let cb = ChannelBuilder::new(self.env.clone())
.max_send_message_len(-1)
.max_receive_message_len(-1)
.keepalive_time(Duration::from_secs(10))
.keepalive_timeout(Duration::from_secs(3));
self.security_mgr.connect(cb, addr_trim)
Expand Down
1 change: 1 addition & 0 deletions components/raftstore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ file_system = { path = "../file_system", default-features = false }
fs2 = "0.4"
futures = "0.3"
futures-util = { version = "0.3.1", default-features = false, features = ["io"] }
getset = "0.1"
into_other = { path = "../into_other", default-features = false }
itertools = "0.10"
keys = { path = "../keys", default-features = false }
Expand Down
9 changes: 9 additions & 0 deletions components/raftstore/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ pub enum Error {
#[error("store ids {0:?}, errmsg {1}")]
DiskFull(Vec<u64>, String),

#[error("region {0} is in the recovery progress")]
RecoveryInProgress(u64),

#[error(
"key {} is not in region key range [{}, {}) for region {}",
log_wrappers::Value::key(.0),
Expand Down Expand Up @@ -238,6 +241,11 @@ impl From<Error> for errorpb::Error {
e.set_region_id(region_id);
errorpb.set_region_not_initialized(e);
}
Error::RecoveryInProgress(region_id) => {
let mut e = errorpb::RecoveryInProgress::default();
e.set_region_id(region_id);
errorpb.set_recovery_in_progress(e);
}
_ => {}
};

Expand Down Expand Up @@ -271,6 +279,7 @@ impl ErrorCodeExt for Error {
Error::RegionNotFound(_) => error_code::raftstore::REGION_NOT_FOUND,
Error::NotLeader(..) => error_code::raftstore::NOT_LEADER,
Error::DiskFull(..) => error_code::raftstore::DISK_FULL,
Error::RecoveryInProgress(..) => error_code::raftstore::RECOVERY_IN_PROGRESS,
Error::StaleCommand => error_code::raftstore::STALE_COMMAND,
Error::RegionNotInitialized(_) => error_code::raftstore::REGION_NOT_INITIALIZED,
Error::KeyNotInRegion(..) => error_code::raftstore::KEY_NOT_IN_REGION,
Expand Down
Loading