From 749b4865d0a26c600fef79ab0456c827faafb9e8 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 18 Sep 2023 12:07:45 +0200 Subject: [PATCH] new layout: improve display and fix comments --- src/garage/cli/layout.rs | 6 +++--- 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());