Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Lok <[email protected]>
  • Loading branch information
andylokandy committed Dec 25, 2023
1 parent 13910c5 commit 6ee59c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/request/keyspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,18 @@ impl TruncateKeyspace for Vec<KvPair> {

impl TruncateKeyspace for Vec<crate::proto::kvrpcpb::LockInfo> {
fn truncate_keyspace(mut self, keyspace: Keyspace) -> Self {
for lock in self.locks.iter_mut() {
lock.key.truncate_keyspace(self.keyspace);
for lock in &mut self {
take_mut::take(&mut lock.key, |key| {
Key::from(key).truncate_keyspace(keyspace).into()
});
take_mut::take(&mut lock.primary_lock, |primary| {
Key::from(primary).truncate_keyspace(keyspace).into()
});
for secondary in lock.secondaries.iter_mut() {
take_mut::take(secondary, |secondary| {
Key::from(secondary).truncate_keyspace(keyspace).into()
});
}
}
self
}
Expand Down
3 changes: 1 addition & 2 deletions src/transaction/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ async fn resolve_lock_with_retry(
let store = pd_client.clone().store_for_key(key.into()).await?;
let ver_id = store.region_with_leader.ver_id();
let request = requests::new_resolve_lock_request(start_version, commit_version);
let encoded_req = EncodedRequest::new(request, pd_client.get_codec());
let plan = crate::request::PlanBuilder::new(pd_client.clone(), encoded_req)
let plan = crate::request::PlanBuilder::new(pd_client.clone(), keyspace, request)
.single_region_with_store(store)
.await?
.resolve_lock(Backoff::no_backoff(), keyspace)
Expand Down

0 comments on commit 6ee59c7

Please sign in to comment.