Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use RegionId region number instead #2273

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/frontend/src/instance/distributed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ fn create_partitions_stmt(partitions: Vec<PartitionInfo>) -> Result<Option<Parti
.into_iter()
.map(|info| {
// Generated the partition name from id
let name = &format!("r{}", info.id.as_u64());
let name = &format!("r{}", info.id.region_number());
let bounds = info.partition.partition_bounds();
let value_list = bounds
.iter()
Expand Down
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
Loading