diff options
author | Alex Auvolat <alex@adnab.me> | 2023-09-18 12:07:45 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-09-18 12:07:45 +0200 |
commit | 749b4865d0a26c600fef79ab0456c827faafb9e8 (patch) | |
tree | 6dd66912faaba361be760c562b17a00fda53c509 | |
parent | 015ccb39aa511c72d0c899713a828491871da3e7 (diff) | |
download | garage-749b4865d0a26c600fef79ab0456c827faafb9e8.tar.gz garage-749b4865d0a26c600fef79ab0456c827faafb9e8.zip |
new layout: improve display and fix comments
-rw-r--r-- | src/garage/cli/layout.rs | 6 | ||||
-rw-r--r-- | src/rpc/layout.rs | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/garage/cli/layout.rs b/src/garage/cli/layout.rs index 557549e2..ce2b11e0 100644 --- a/src/garage/cli/layout.rs +++ b/src/garage/cli/layout.rs @@ -282,7 +282,7 @@ pub async fn cmd_config_layout( layout .staging_parameters .update(LayoutParameters { zone_redundancy: r }); - println!("The new zone redundancy has been saved ({}).", r); + println!("The zone redundancy parameter has been set to '{}'.", r); did_something = true; } } @@ -359,11 +359,11 @@ pub fn print_cluster_layout(layout: &ClusterLayout, empty_msg: &str) { } if table.len() > 1 { format_table(table); + println!(); + println!("Zone redundancy: {}", layout.parameters.zone_redundancy); } else { println!("{}", empty_msg); } - println!(); - println!("Zone redundancy: {}", layout.parameters.zone_redundancy); } pub fn print_staging_role_changes(layout: &ClusterLayout) -> bool { diff --git a/src/rpc/layout.rs b/src/rpc/layout.rs index 9aa9c584..c106114b 100644 --- a/src/rpc/layout.rs +++ b/src/rpc/layout.rs @@ -121,7 +121,7 @@ mod v09 { /// Zone redundancy: if set to AtLeast(x), the layout calculation will aim to store copies /// of each partition on at least that number of different zones. - /// If None, copies will be stored on the maximum possible number of zones. + /// Otherwise, copies will be stored on the maximum possible number of zones. #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug, Serialize, Deserialize)] pub enum ZoneRedundancy { AtLeast(usize), @@ -161,7 +161,7 @@ mod v09 { .min() .unwrap_or(0); - // By default, zone_redundancy is None (i.e. maximum possible value) + // By default, zone_redundancy is maximum possible value let parameters = LayoutParameters { zone_redundancy: ZoneRedundancy::Maximum, }; @@ -253,7 +253,7 @@ impl core::str::FromStr for ZoneRedundancy { // Implementation of the ClusterLayout methods unrelated to the assignment algorithm. impl ClusterLayout { pub fn new(replication_factor: usize) -> Self { - // We set the default zone redundancy to be None, meaning that the maximum + // We set the default zone redundancy to be Maximum, meaning that the maximum // possible value will be used depending on the cluster topology let parameters = LayoutParameters { zone_redundancy: ZoneRedundancy::Maximum, @@ -1005,12 +1005,12 @@ impl ClusterLayout { msg.push("".into()); msg.push( "If the percentage is too low, it might be that the \ - replication/redundancy constraints force the use of nodes/zones with small \ + cluster topology and redundancy constraints are forcing the use of nodes/zones with small \ storage capacities." .into(), ); msg.push( - "You might want to rebalance the storage capacities or relax the constraints." + "You might want to move storage capacity between zones or relax the redundancy constraint." .into(), ); msg.push( @@ -1105,8 +1105,8 @@ impl ClusterLayout { tags_n, stored_partitions[*n], new_partitions[*n], - ByteSize::b(available_cap_n).to_string_as(false), ByteSize::b(total_cap_n).to_string_as(false), + ByteSize::b(available_cap_n).to_string_as(false), (available_cap_n as f32) / (total_cap_n as f32) * 100.0, )); } @@ -1116,8 +1116,8 @@ impl ClusterLayout { replicated_partitions, stored_partitions_zone[z], //new_partitions_zone[z], - ByteSize::b(available_cap_z).to_string_as(false), ByteSize::b(total_cap_z).to_string_as(false), + ByteSize::b(available_cap_z).to_string_as(false), percent_cap_z )); table.push("".into()); |