aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-11-11 12:37:33 +0100
committerAlex Auvolat <alex@adnab.me>2023-11-11 12:44:27 +0100
commitdf24bb806d64d5d5e748c35efe3f49ad3dda709e (patch)
tree4314a04ba2f01a297eedd0a45566551e74239ef2 /src/rpc
parentce89d1ddabe3b9e638b0173949726522ae9a0311 (diff)
downloadgarage-df24bb806d64d5d5e748c35efe3f49ad3dda709e.tar.gz
garage-df24bb806d64d5d5e748c35efe3f49ad3dda709e.zip
layout/sync: fix bugs and add tracing
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/layout/history.rs3
-rw-r--r--src/rpc/layout/manager.rs10
2 files changed, 10 insertions, 3 deletions
diff --git a/src/rpc/layout/history.rs b/src/rpc/layout/history.rs
index 185dbb27..cef56647 100644
--- a/src/rpc/layout/history.rs
+++ b/src/rpc/layout/history.rs
@@ -131,7 +131,8 @@ impl LayoutHistory {
pub(crate) fn cleanup_old_versions(&mut self) {
let min_sync_ack = self.calculate_global_min(&self.update_trackers.sync_ack_map);
while self.versions.first().as_ref().unwrap().version < min_sync_ack {
- self.versions.remove(0);
+ let removed = self.versions.remove(0);
+ info!("Layout history: pruning old version {}", removed.version);
}
}
diff --git a/src/rpc/layout/manager.rs b/src/rpc/layout/manager.rs
index 7d60bae6..ce8b6f61 100644
--- a/src/rpc/layout/manager.rs
+++ b/src/rpc/layout/manager.rs
@@ -133,7 +133,7 @@ impl LayoutManager {
pub fn sync_table_until(self: &Arc<Self>, table_name: &'static str, version: u64) {
let mut table_sync_version = self.table_sync_version.lock().unwrap();
*table_sync_version.get_mut(table_name).unwrap() = version;
- let sync_until = table_sync_version.iter().map(|(_, v)| *v).max().unwrap();
+ let sync_until = table_sync_version.iter().map(|(_, v)| *v).min().unwrap();
drop(table_sync_version);
let mut layout = self.layout.write().unwrap();
@@ -142,6 +142,7 @@ impl LayoutManager {
.sync_map
.set_max(self.node_id, sync_until)
{
+ debug!("sync_until updated to {}", sync_until);
layout.update_hashes();
self.broadcast_update(SystemRpc::AdvertiseClusterLayoutTrackers(
layout.update_trackers.clone(),
@@ -277,7 +278,12 @@ impl LayoutManager {
self: &Arc<Self>,
adv: &LayoutHistory,
) -> Result<SystemRpc, Error> {
- debug!("handle_advertise_cluster_layout: {:?}", adv);
+ debug!(
+ "handle_advertise_cluster_layout: {} versions, last={}, trackers={:?}",
+ adv.versions.len(),
+ adv.current().version,
+ adv.update_trackers
+ );
if adv.current().replication_factor != self.replication_factor {
let msg = format!(