diff --git a/src/common/meta/src/key.rs b/src/common/meta/src/key.rs index abe116f973e5..0c62d89e4dfb 100644 --- a/src/common/meta/src/key.rs +++ b/src/common/meta/src/key.rs @@ -427,7 +427,7 @@ impl TableMetadataManager { ®ion_storage_path, region_options, region_wal_options, - region_distribution(&x.region_routes)?, + region_distribution(&x.region_routes), )?; txn = txn.merge(create_datanode_table_txn); } @@ -483,7 +483,7 @@ impl TableMetadataManager { .build_delete_txn(table_id, table_info_value)?; // Deletes datanode table key value pairs. - let distribution = region_distribution(table_route_value.region_routes()?)?; + let distribution = region_distribution(table_route_value.region_routes()?); let delete_datanode_txn = self .datanode_table_manager() .build_delete_txn(table_id, distribution)?; @@ -608,8 +608,8 @@ impl TableMetadataManager { ) -> Result<()> { // Updates the datanode table key value pairs. let current_region_distribution = - region_distribution(current_table_route_value.region_routes()?)?; - let new_region_distribution = region_distribution(&new_region_routes)?; + region_distribution(current_table_route_value.region_routes()?); + let new_region_distribution = region_distribution(&new_region_routes); let update_datanode_table_txn = self.datanode_table_manager().build_update_txn( table_id, @@ -1191,7 +1191,7 @@ mod tests { table_id: u32, region_routes: &[RegionRoute], ) { - let region_distribution = region_distribution(region_routes).unwrap(); + let region_distribution = region_distribution(region_routes); for (datanode, regions) in region_distribution { let got = table_metadata_manager .datanode_table_manager() diff --git a/src/common/meta/src/key/table_route.rs b/src/common/meta/src/key/table_route.rs index 4d2ac35001f3..bd2e86d0501a 100644 --- a/src/common/meta/src/key/table_route.rs +++ b/src/common/meta/src/key/table_route.rs @@ -376,7 +376,7 @@ impl TableRouteManager { ) -> Result> { self.get(table_id) .await? - .map(|table_route| region_distribution(table_route.region_routes()?)) + .map(|table_route| Ok(region_distribution(table_route.region_routes()?))) .transpose() } } diff --git a/src/common/meta/src/rpc/router.rs b/src/common/meta/src/rpc/router.rs index e37529635390..806ce5f6575a 100644 --- a/src/common/meta/src/rpc/router.rs +++ b/src/common/meta/src/rpc/router.rs @@ -30,7 +30,7 @@ use crate::peer::Peer; use crate::table_name::TableName; use crate::DatanodeId; -pub fn region_distribution(region_routes: &[RegionRoute]) -> Result { +pub fn region_distribution(region_routes: &[RegionRoute]) -> RegionDistribution { let mut regions_id_map = RegionDistribution::new(); for route in region_routes.iter() { if let Some(peer) = route.leader_peer.as_ref() { @@ -42,7 +42,7 @@ pub fn region_distribution(region_routes: &[RegionRoute]) -> Result>(); diff --git a/tests-integration/src/instance.rs b/tests-integration/src/instance.rs index 5b7ed080d9d9..5b84c6811ce9 100644 --- a/tests-integration/src/instance.rs +++ b/tests-integration/src/instance.rs @@ -221,7 +221,6 @@ mod tests { .region_routes() .expect("region routes should be physical"), ) - .unwrap() .iter() .map(|(k, v)| (v[0], *k)) .collect::>();