Skip to content

Commit

Permalink
fix: use RegionId region number instead
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Aug 28, 2023
1 parent ef75e8f commit d7999b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl UpdateRegionMetadata {
let mut new_region_routes = table_route_value.region_routes.clone();

for region_route in new_region_routes.iter_mut() {
if region_route.region.id == failed_region.region_number as u64 {
if region_route.region.id.region_number() == failed_region.region_number {
region_route.leader_peer = Some(self.candidate.clone());
break;
}
Expand Down
6 changes: 3 additions & 3 deletions src/meta-srv/src/service/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ async fn handle_create_region_routes(
// If the peers are not enough, some peers will be used for multiple partitions.
peers.truncate(partitions.len());

let id = table_id_sequence.next().await?;
table_info.ident.table_id = id as u32;
let table_id = table_id_sequence.next().await? as u32;
table_info.ident.table_id = table_id;

ensure!(
partitions.len() <= MAX_REGION_SEQ as usize,
Expand All @@ -191,7 +191,7 @@ async fn handle_create_region_routes(
.enumerate()
.map(|(i, partition)| {
let region = Region {
id: RegionId::from_u64(i as u64),
id: RegionId::new(table_id, i as u32),
partition: Some(partition.into()),
..Default::default()
};
Expand Down

0 comments on commit d7999b7

Please sign in to comment.