diff options
author | Alex Auvolat <alex@adnab.me> | 2020-04-16 19:57:13 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-04-16 19:57:13 +0200 |
commit | 768d22ccdb5e8f563145fdf26ba0c336f31b2ccf (patch) | |
tree | 4790b20c8f7cc6bc262105bca70e4f70f2690c60 | |
parent | 2a05fd135a3247d7161612e496e8ab3d98137d8e (diff) | |
download | garage-768d22ccdb5e8f563145fdf26ba0c336f31b2ccf.tar.gz garage-768d22ccdb5e8f563145fdf26ba0c336f31b2ccf.zip |
Better prints again, and a great question
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | src/table_sync.rs | 13 |
2 files changed, 11 insertions, 4 deletions
@@ -5,6 +5,8 @@ Replication - every node watches the current ring and state of the network - and thus determines the interval of tokens for which they are responsible +How are we going to test that our replication method works correctly? +We will have to introduce lots of dummy data and then add/remove nodes many times. To do list diff --git a/src/table_sync.rs b/src/table_sync.rs index f6d4c750..013e6358 100644 --- a/src/table_sync.rs +++ b/src/table_sync.rs @@ -149,9 +149,8 @@ impl<F: TableSchema + 'static> TableSyncer<F> { } async fn sync_partition(self: Arc<Self>, partition: &Partition, must_exit: &mut watch::Receiver<bool>) -> Result<(), Error> { - eprintln!("({}) Calculating root checksum for {:?}...", self.table.name, partition); + eprintln!("({}) Preparing to sync {:?}...", self.table.name, partition); let root_cks = self.root_checksum(&partition.begin, &partition.end, must_exit).await?; - eprintln!("({}) Root checksum for {:?}: {:?}", self.table.name, partition, root_cks); let nodes = self.table.system.ring.borrow().clone().walk_ring(&partition.begin, self.table.param.replication_factor); let mut sync_futures = nodes.iter() @@ -196,9 +195,14 @@ impl<F: TableSchema + 'static> TableSyncer<F> { drop(cache); let v = self.range_checksum_inner(&range, must_exit).await?; + eprintln!("({}) New checksum calculated for {}-{}/{}, {} children", + self.table.name, + hex::encode(&range.begin[..]), + hex::encode(&range.end[..]), + range.level, + v.children.len()); let mut cache = self.cache[range.level].lock().await; - eprintln!("({}) Checksum for {:?}: {:?}", self.table.name, range, v); cache.insert(range.clone(), v.clone()); Ok(v) }.boxed() @@ -281,7 +285,8 @@ impl<F: TableSchema + 'static> TableSyncer<F> { todo.push_back(root_ck); while !todo.is_empty() && !*must_exit.borrow() { - eprintln!("({}) Sync with {:?}: {} remaining", self.table.name, who, todo.len()); + let total_children = todo.iter().map(|x| x.children.len()).fold(0, |x, y| x + y); + eprintln!("({}) Sync with {:?}: {} ({}) remaining", self.table.name, who, todo.len(), total_children); let end = std::cmp::min(16, todo.len()); let step = todo.drain(..end).collect::<Vec<_>>(); |