Compare commits

...

2 commits

Author SHA1 Message Date
c731f0291a Merge pull request 'fix logic in garage layout skip-dead-nodes + fix typo (fix #879)' (#880) from fix-skip-dead-nodes into main
All checks were successful
ci/woodpecker/push/debug Pipeline was successful
ci/woodpecker/deployment/debug Pipeline was successful
ci/woodpecker/deployment/release/3 Pipeline was successful
ci/woodpecker/deployment/release/2 Pipeline was successful
ci/woodpecker/deployment/release/1 Pipeline was successful
ci/woodpecker/deployment/release/4 Pipeline was successful
ci/woodpecker/deployment/publish Pipeline was successful
Reviewed-on: #880
2024-09-22 12:01:49 +00:00
34453bc9c2
fix logic in garage layout skip-dead-nodes + fix typo (fix #879)
All checks were successful
ci/woodpecker/push/debug Pipeline was successful
ci/woodpecker/pr/debug Pipeline was successful
2024-09-22 13:47:27 +02:00
2 changed files with 25 additions and 13 deletions

View file

@ -358,7 +358,7 @@ pub async fn cmd_layout_history(
if layout.versions.len() > 1 { if layout.versions.len() > 1 {
println!("==== UPDATE TRACKERS ===="); println!("==== UPDATE TRACKERS ====");
println!("Several layout versions are currently live in the version, and data is being migrated."); println!("Several layout versions are currently live in the cluster, and data is being migrated.");
println!( println!(
"This is the internal data that Garage stores to know which nodes have what data." "This is the internal data that Garage stores to know which nodes have what data."
); );
@ -377,15 +377,27 @@ pub async fn cmd_layout_history(
table[1..].sort(); table[1..].sort();
format_table(table); format_table(table);
let min_ack = layout
.update_trackers
.ack_map
.min_among(&all_nodes, layout.min_stored());
println!(); println!();
println!( println!(
"If some nodes are not catching up to the latest layout version in the update trackers," "If some nodes are not catching up to the latest layout version in the update trackers,"
); );
println!("it might be because they are offline or unable to complete a sync successfully."); println!("it might be because they are offline or unable to complete a sync successfully.");
println!( if min_ack < layout.current().version {
"You may force progress using `garage layout skip-dead-nodes --version {}`", println!(
layout.current().version "You may force progress using `garage layout skip-dead-nodes --version {}`",
); layout.current().version
);
} else {
println!(
"You may force progress using `garage layout skip-dead-nodes --version {} --allow-missing-data`.",
layout.current().version
);
}
} else { } else {
println!("Your cluster is currently in a stable state with a single live layout version."); println!("Your cluster is currently in a stable state with a single live layout version.");
println!("No metadata migration is in progress. Note that the migration of data blocks is not tracked,"); println!("No metadata migration is in progress. Note that the migration of data blocks is not tracked,");
@ -426,15 +438,15 @@ pub async fn cmd_layout_skip_dead_nodes(
let all_nodes = layout.get_all_nodes(); let all_nodes = layout.get_all_nodes();
let mut did_something = false; let mut did_something = false;
for node in all_nodes.iter() { for node in all_nodes.iter() {
if status.iter().any(|x| x.id == *node && x.is_up) { // Update ACK tracker for dead nodes or for all nodes if --allow-missing-data
continue; if opt.allow_missing_data || !status.iter().any(|x| x.id == *node && x.is_up) {
} if layout.update_trackers.ack_map.set_max(*node, opt.version) {
println!("Increased the ACK tracker for node {:?}", node);
if layout.update_trackers.ack_map.set_max(*node, opt.version) { did_something = true;
println!("Increased the ACK tracker for node {:?}", node); }
did_something = true;
} }
// If --allow-missing-data, update SYNC tracker for all nodes.
if opt.allow_missing_data { if opt.allow_missing_data {
if layout.update_trackers.sync_map.set_max(*node, opt.version) { if layout.update_trackers.sync_map.set_max(*node, opt.version) {
println!("Increased the SYNC tracker for node {:?}", node); println!("Increased the SYNC tracker for node {:?}", node);

View file

@ -455,7 +455,7 @@ impl UpdateTracker {
} }
} }
pub(crate) fn min_among(&self, storage_nodes: &[Uuid], min_version: u64) -> u64 { pub fn min_among(&self, storage_nodes: &[Uuid], min_version: u64) -> u64 {
storage_nodes storage_nodes
.iter() .iter()
.map(|x| self.get(x, min_version)) .map(|x| self.get(x, min_version))