Include old_versions when merging layouts, don't remove old layout versions #854

Closed
dominik wants to merge 3 commits from dominik/garage:historical_layout_fix into main
Showing only changes of commit 824e473809 - Show all commits

View file

@ -226,12 +226,12 @@ impl LayoutHistory {
// Add any new versions to history // Add any new versions to history
for v2 in other.old_versions.iter().chain(other.versions.iter()) { for v2 in other.old_versions.iter().chain(other.versions.iter()) {
if let Some(v1) = self.versions.iter().find(|v| v.version == v2.version) { if let Some(v1) = self.old_versions.iter().chain(self.versions.iter()).find(|v| v.version == v2.version) {
// Version is already present, check consistency // Version is already present, check consistency
if v1 != v2 { if v1 != v2 {
error!("Inconsistent layout histories: different layout compositions for version {}. Your cluster will be broken as long as this layout version is not replaced.", v2.version); error!("Inconsistent layout histories: different layout compositions for version {}. Your cluster will be broken as long as this layout version is not replaced.", v2.version);
} }
} else if self.versions.iter().all(|v| v.version != v2.version - 1) { } else if self.old_versions.iter().chain(self.versions.iter()).all(|v| v.version != v2.version - 1) {
error!( error!(
"Cannot receive new layout version {}, version {} is missing", "Cannot receive new layout version {}, version {} is missing",
v2.version, v2.version,