Merge branch 'master' into handle-pd-get-member-with-err

This commit is contained in:
Ping Yu 2024-06-02 12:41:04 +08:00 committed by GitHub
commit 9eb216774a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 43 additions and 23 deletions

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct AutoIdRequest { pub struct AutoIdRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The message save the metadata of a backup. /// The message save the metadata of a backup.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct Header { pub struct Header {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct Status { pub struct Status {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// \[start, end) /// \[start, end)
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct WaitForEntriesRequest {} pub struct WaitForEntriesRequest {}

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRequest { pub struct GetRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchLogRequest { pub struct SearchLogRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct S3LockResult { pub struct S3LockResult {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)] #[repr(i32)]
pub enum DiskUsage { pub enum DiskUsage {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// General encryption metadata for any data type. /// General encryption metadata for any data type.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandRequestHeader { pub struct CommandRequestHeader {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The entry is a type of change that needs to be applied. It contains two data fields. /// The entry is a type of change that needs to be applied. It contains two data fields.
/// While the fields are built into the model; their usage is determined by the entry_type. /// While the fields are built into the model; their usage is determined by the entry_type.
/// ///

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// NotLeader is the error variant that tells a request be handle by raft leader /// NotLeader is the error variant that tells a request be handle by raft leader
/// is sent to raft follower or learner. /// is sent to raft follower or learner.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader { pub struct RequestHeader {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// Defines the HTTP configuration for an API service. It contains a list of /// Defines the HTTP configuration for an API service. It contains a list of
/// \[HttpRule\]\[google.api.HttpRule\], each specifying the mapping of an RPC method /// \[HttpRule\]\[google.api.HttpRule\], each specifying the mapping of an RPC method
/// to one or more HTTP REST API methods. /// to one or more HTTP REST API methods.

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct SwitchModeRequest { pub struct SwitchModeRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct SuspendImportRpcRequest { pub struct SuspendImportRpcRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyspaceMeta { pub struct KeyspaceMeta {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// A transactional get command. Lookup a value for `key` in the transaction with /// A transactional get command. Lookup a value for `key` in the transaction with
/// starting timestamp = `version`. /// starting timestamp = `version`.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The minimal information for identify a region. /// The minimal information for identify a region.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error { pub struct Error {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct Cluster { pub struct Cluster {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
pub mod autoid { pub mod autoid {
include!("autoid.rs"); include!("autoid.rs");
} }

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// TaskMeta contains meta of a mpp plan, including query's ts and task address. /// TaskMeta contains meta of a mpp plan, including query's ts and task address.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct WatchGlobalConfigRequest { pub struct WatchGlobalConfigRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRequest { pub struct GetRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaftMessage { pub struct RaftMessage {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// request to read region meata from a store /// request to read region meata from a store
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The replication status sync from PD to TiKV. /// The replication status sync from PD to TiKV.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListResourceGroupsRequest {} pub struct ListResourceGroupsRequest {}

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceMeteringRequest {} pub struct ResourceMeteringRequest {}

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader { pub struct RequestHeader {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCommandsRequest { pub struct BatchCommandsRequest {

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct TraceRecordRequest {} pub struct TraceRecordRequest {}

View File

@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader { pub struct RequestHeader {

View File

@ -49,7 +49,7 @@ impl Cluster {
timeout: Duration, timeout: Duration,
) -> Result<pdpb::GetRegionResponse> { ) -> Result<pdpb::GetRegionResponse> {
let mut req = pd_request!(self.id, pdpb::GetRegionRequest); let mut req = pd_request!(self.id, pdpb::GetRegionRequest);
req.region_key = key.clone(); req.region_key = key;
req.send(&mut self.client, timeout).await req.send(&mut self.client, timeout).await
} }
@ -101,7 +101,7 @@ impl Cluster {
timeout: Duration, timeout: Duration,
) -> Result<keyspacepb::KeyspaceMeta> { ) -> Result<keyspacepb::KeyspaceMeta> {
let mut req = pd_request!(self.id, keyspacepb::LoadKeyspaceRequest); let mut req = pd_request!(self.id, keyspacepb::LoadKeyspaceRequest);
req.name = keyspace.to_owned(); req.name = keyspace.to_string();
let resp = req.send(&mut self.keyspace_client, timeout).await?; let resp = req.send(&mut self.keyspace_client, timeout).await?;
let keyspace = resp let keyspace = resp
.keyspace .keyspace

View File

@ -472,7 +472,7 @@ impl Shardable for RawCoprocessorRequest {
fn apply_shard(&mut self, shard: Self::Shard, store: &RegionStore) -> Result<()> { fn apply_shard(&mut self, shard: Self::Shard, store: &RegionStore) -> Result<()> {
self.set_leader(&store.region_with_leader)?; self.set_leader(&store.region_with_leader)?;
self.inner.ranges = shard.clone(); self.inner.ranges.clone_from(&shard);
self.inner.data = (self.data_builder)(store.region_with_leader.region.clone(), shard); self.inner.data = (self.data_builder)(store.region_with_leader.region.clone(), shard);
Ok(()) Ok(())
} }

View File

@ -575,10 +575,10 @@ mod test {
}); });
assert!(!is_valid_tikv_store(&store)); assert!(!is_valid_tikv_store(&store));
store.labels[1].value = "tiflash_compute".to_owned(); store.labels[1].value = "tiflash_compute".to_string();
assert!(!is_valid_tikv_store(&store)); assert!(!is_valid_tikv_store(&store));
store.labels[1].value = "other".to_owned(); store.labels[1].value = "other".to_string();
assert!(is_valid_tikv_store(&store)); assert!(is_valid_tikv_store(&store));
} }
} }

View File

@ -8,7 +8,6 @@ use std::cmp::max;
use std::cmp::min; use std::cmp::min;
use std::sync::Arc; use std::sync::Arc;
use async_trait::async_trait;
use derive_new::new; use derive_new::new;
use futures::prelude::*; use futures::prelude::*;
use futures::stream::BoxStream; use futures::stream::BoxStream;
@ -38,21 +37,6 @@ pub struct Store {
pub client: Arc<dyn KvClient + Send + Sync>, pub client: Arc<dyn KvClient + Send + Sync>,
} }
#[async_trait]
pub trait KvConnectStore: KvConnect {
async fn connect_to_store(
&self,
region: RegionWithLeader,
address: String,
) -> Result<RegionStore> {
log::info!("connect to tikv endpoint: {:?}", &address);
let client = self.connect(address.as_str()).await?;
Ok(RegionStore::new(region, Arc::new(client)))
}
}
impl KvConnectStore for TikvConnect {}
/// Maps keys to a stream of stores. `key_data` must be sorted in increasing order /// Maps keys to a stream of stores. `key_data` must be sorted in increasing order
pub fn store_stream_for_keys<K, KOut, PdC>( pub fn store_stream_for_keys<K, KOut, PdC>(
key_data: impl Iterator<Item = K> + Send + Sync + 'static, key_data: impl Iterator<Item = K> + Send + Sync + 'static,

View File

@ -358,13 +358,13 @@ impl BufferEntry {
BufferEntry::Cached(_) => return None, BufferEntry::Cached(_) => return None,
BufferEntry::Put(v) => { BufferEntry::Put(v) => {
pb.op = kvrpcpb::Op::Put.into(); pb.op = kvrpcpb::Op::Put.into();
pb.value = v.clone(); pb.value.clone_from(v);
} }
BufferEntry::Del => pb.op = kvrpcpb::Op::Del.into(), BufferEntry::Del => pb.op = kvrpcpb::Op::Del.into(),
BufferEntry::Locked(_) => pb.op = kvrpcpb::Op::Lock.into(), BufferEntry::Locked(_) => pb.op = kvrpcpb::Op::Lock.into(),
BufferEntry::Insert(v) => { BufferEntry::Insert(v) => {
pb.op = kvrpcpb::Op::Insert.into(); pb.op = kvrpcpb::Op::Insert.into();
pb.value = v.clone(); pb.value.clone_from(v);
} }
BufferEntry::CheckNotExist => pb.op = kvrpcpb::Op::CheckNotExists.into(), BufferEntry::CheckNotExist => pb.op = kvrpcpb::Op::CheckNotExists.into(),
}; };