Skip to content

Commit

Permalink
add debug log of region
Browse files Browse the repository at this point in the history
  • Loading branch information
bxq2011hust committed Jan 16, 2023
1 parent e835d9a commit 8b62848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/request/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::{marker::PhantomData, sync::Arc};
use async_recursion::async_recursion;
use async_trait::async_trait;
use futures::{future::try_join_all, prelude::*};
use log::debug;
use tikv_client_proto::{errorpb, errorpb::EpochNotMatch, kvrpcpb};
use tikv_client_store::{HasKeyErrors, HasRegionError, HasRegionErrors, KvClient};
use tokio::sync::Semaphore;
use log::{debug};

use crate::{
backoff::Backoff,
Expand Down Expand Up @@ -48,7 +48,7 @@ impl<Req: KvRequest> Plan for Dispatch<Req> {
let result = self
.kv_client
.as_ref()
.expect("Unreachable: kv_client has not been initialised in Dispatch")
.expect("Unreachable: kv_client has not been initialized in Dispatch")
.dispatch(&self.request)
.await;
let result = stats.done(result);
Expand Down Expand Up @@ -87,6 +87,7 @@ where
) -> Result<<Self as Plan>::Result> {
let shards = current_plan.shards(&pd_client).collect::<Vec<_>>().await;
let mut handles = Vec::new();
debug!("retry_multi_region request shard size = {}", shards.len());
for shard in shards {
let (shard, region_store) = shard?;
let mut clone = current_plan.clone();
Expand Down Expand Up @@ -425,7 +426,8 @@ where

if self.backoff.is_none() {
debug!(
"resolve lock failed because backoff is none, locks={:?}", locks
"resolve lock failed because backoff is none, locks={:?}",
locks
);
return Err(Error::ResolveLockError);
}
Expand Down
1 change: 1 addition & 0 deletions src/transaction/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ impl Shardable for kvrpcpb::PrewriteRequest {
) -> BoxStream<'static, Result<(Self::Shard, RegionStore)>> {
let mut mutations = self.mutations.clone();
mutations.sort_by(|a, b| a.key.cmp(&b.key));
log::debug!("PrewriteRequest shards");
store_stream_for_keys(mutations.into_iter(), pd_client.clone())
}

Expand Down

0 comments on commit 8b62848

Please sign in to comment.