Include old_versions
when merging layouts, don't remove old layout versions #854
2 changed files with 13 additions and 11 deletions
|
@ -107,11 +107,6 @@ impl LayoutHistory {
|
||||||
);
|
);
|
||||||
self.old_versions.push(removed);
|
self.old_versions.push(removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
while self.old_versions.len() > OLD_VERSION_COUNT {
|
|
||||||
let removed = self.old_versions.remove(0);
|
|
||||||
info!("Layout history: removing old_version {}", removed.version);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn clamp_update_trackers(&mut self, nodes: &[Uuid]) {
|
pub(crate) fn clamp_update_trackers(&mut self, nodes: &[Uuid]) {
|
||||||
|
@ -230,13 +225,23 @@ impl LayoutHistory {
|
||||||
let mut changed = false;
|
let mut changed = false;
|
||||||
|
|
||||||
// Add any new versions to history
|
// Add any new versions to history
|
||||||
for v2 in 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,
|
||||||
|
|
|
@ -231,9 +231,6 @@ mod v010 {
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
pub use v09::{LayoutParameters, NodeRole, NodeRoleV, ZoneRedundancy};
|
pub use v09::{LayoutParameters, NodeRole, NodeRoleV, ZoneRedundancy};
|
||||||
|
|
||||||
/// Number of old (non-live) versions to keep, see LayoutHistory::old_versions
|
|
||||||
pub const OLD_VERSION_COUNT: usize = 5;
|
|
||||||
|
|
||||||
/// The history of cluster layouts, with trackers to keep a record
|
/// The history of cluster layouts, with trackers to keep a record
|
||||||
/// of which nodes are up-to-date to current cluster data
|
/// of which nodes are up-to-date to current cluster data
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||||
|
|
Loading…
Reference in a new issue