diff options
author | Alex Auvolat <alex@adnab.me> | 2023-11-09 15:31:59 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-11-09 15:31:59 +0100 |
commit | 03ebf18830dff1983f09abe6ecb8d8d26daeb446 (patch) | |
tree | 64cda96cf24e4922fb78785fd7dcce02c0b80c04 /src/rpc/layout/manager.rs | |
parent | 94caf9c0c1342ce1d2ba3ac7af39fb133721ee83 (diff) | |
download | garage-03ebf18830dff1983f09abe6ecb8d8d26daeb446.tar.gz garage-03ebf18830dff1983f09abe6ecb8d8d26daeb446.zip |
layout: begin managing the update tracker values
Diffstat (limited to 'src/rpc/layout/manager.rs')
-rw-r--r-- | src/rpc/layout/manager.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rpc/layout/manager.rs b/src/rpc/layout/manager.rs index a2502f58..ffcc938b 100644 --- a/src/rpc/layout/manager.rs +++ b/src/rpc/layout/manager.rs @@ -51,7 +51,7 @@ impl LayoutManager { let persist_cluster_layout: Persister<LayoutHistory> = Persister::new(&config.metadata_dir, "cluster_layout"); - let cluster_layout = match persist_cluster_layout.load() { + let mut cluster_layout = match persist_cluster_layout.load() { Ok(x) => { if x.current().replication_factor != replication_factor { return Err(Error::Message(format!( @@ -71,6 +71,8 @@ impl LayoutManager { } }; + cluster_layout.update_trackers(node_id.into()); + let layout = Arc::new(RwLock::new(cluster_layout)); let change_notify = Arc::new(Notify::new()); @@ -126,7 +128,7 @@ impl LayoutManager { if prev_layout_check && layout.check().is_err() { panic!("Merged two correct layouts and got an incorrect layout."); } - + layout.update_trackers(self.node_id); return Some(layout.clone()); } } @@ -137,6 +139,7 @@ impl LayoutManager { let mut layout = self.layout.write().unwrap(); if layout.update_trackers != *adv { if layout.update_trackers.merge(adv) { + layout.update_trackers(self.node_id); return Some(layout.update_trackers.clone()); } } |