Skip to content

Commit

Permalink
moving the region and store lookup inside the loop and removing the c…
Browse files Browse the repository at this point in the history
…lippy fix from Makefile

Signed-off-by: limbooverlambda <[email protected]>
  • Loading branch information
limbooverlambda committed Aug 10, 2024
1 parent 8bdd1d5 commit 6b40932
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ generate:
check: generate
cargo check --all --all-targets --features "${ALL_FEATURES}"
cargo fmt -- --check
cargo clippy --fix --allow-dirty --all-targets --features "${ALL_FEATURES}" -- -D clippy::all
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all

unit-test: generate
cargo nextest run --all --no-default-features
Expand Down
1 change: 1 addition & 0 deletions src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

pub use protos::*;

#[allow(clippy::doc_lazy_continuation)]
mod protos {
include!("generated/mod.rs");
}
18 changes: 9 additions & 9 deletions src/raw/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,16 +806,16 @@ impl<PdC: PdClient> Client<PdC> {
) -> Result<(Option<RawScanResponse>, Key)> {
let start_key = scan_args.start_key;

let region = self.rpc.clone().region_for_key(&start_key).await?;
let store = self.rpc.clone().store_for_id(region.id()).await?;
let request = new_raw_scan_request(
scan_args.range.clone(),
scan_args.limit,
scan_args.key_only,
scan_args.reverse,
self.cf.clone(),
);
loop {
let region = self.rpc.clone().region_for_key(&start_key).await?;
let store = self.rpc.clone().store_for_id(region.id()).await?;
let request = new_raw_scan_request(
scan_args.range.clone(),
scan_args.limit,
scan_args.key_only,
scan_args.reverse,
self.cf.clone(),
);
let resp = self.do_store_scan(store.clone(), request.clone()).await;
return match resp {
Ok(mut r) => {
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const SCAN_LOCK_BATCH_SIZE: u32 = 1024;
/// - `gc`: trigger a GC process which clears stale data in the cluster.
/// - `current_timestamp`: get the current `Timestamp` from PD.
/// - `snapshot`: get a [`Snapshot`] of the database at a specified timestamp.
/// A `Snapshot` is a read-only transaction.
/// A `Snapshot` is a read-only transaction.
///
/// The returned results of transactional requests are [`Future`](std::future::Future)s that must be
/// awaited to execute.
Expand Down
1 change: 0 additions & 1 deletion src/transaction/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,6 @@ impl Merge<kvrpcpb::UnsafeDestroyRangeResponse> for Collect {
}

#[cfg(test)]
#[cfg_attr(feature = "protobuf-codec", allow(clippy::useless_conversion))]
mod tests {
use crate::common::Error::PessimisticLockError;
use crate::common::Error::ResolveLockError;
Expand Down

0 comments on commit 6b40932

Please sign in to comment.