Include old_versions when merging layouts, don't remove old layout versions
All checks were successful
ci/woodpecker/pr/debug Pipeline was successful

This commit is contained in:
Dominik Grygiel 2024-08-15 17:47:16 +02:00
parent 3a87bd1370
commit f8d0affd82
2 changed files with 1 additions and 9 deletions

View file

@ -107,11 +107,6 @@ impl LayoutHistory {
);
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]) {
@ -230,7 +225,7 @@ impl LayoutHistory {
let mut changed = false;
// 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) {
// Version is already present, check consistency
if v1 != v2 {

View file

@ -231,9 +231,6 @@ mod v010 {
use std::collections::BTreeMap;
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
/// of which nodes are up-to-date to current cluster data
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]