diff options
author | Alex Auvolat <alex@adnab.me> | 2023-11-27 11:52:57 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-11-27 11:52:57 +0100 |
commit | d6d239fc7909cbd017da6ea35cceb3d561a87cca (patch) | |
tree | 18725effafdd990d7e2953adcc1b50399673caed /src/rpc/layout/history.rs | |
parent | 3ecd14b9f6202ad3c5513c6ad7422bd408134002 (diff) | |
download | garage-d6d239fc7909cbd017da6ea35cceb3d561a87cca.tar.gz garage-d6d239fc7909cbd017da6ea35cceb3d561a87cca.zip |
block manager: read_block using old layout versions if necessary
Diffstat (limited to 'src/rpc/layout/history.rs')
-rw-r--r-- | src/rpc/layout/history.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rpc/layout/history.rs b/src/rpc/layout/history.rs index 653d2a48..7d4a1b48 100644 --- a/src/rpc/layout/history.rs +++ b/src/rpc/layout/history.rs @@ -18,6 +18,7 @@ impl LayoutHistory { LayoutHistory { versions: vec![version], + old_versions: vec![], update_trackers: Default::default(), staging: Lww::raw(0, staging), } @@ -86,11 +87,20 @@ impl LayoutHistory { .min(&all_nongateway_nodes, min_version); if self.min_stored() < sync_ack_map_min { let removed = self.versions.remove(0); - info!("Layout history: pruning old version {}", removed.version); + info!( + "Layout history: moving version {} to old_versions", + removed.version + ); + self.old_versions.push(removed); } else { break; } } + + 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]) { |