diff options
author | Alex Auvolat <alex@adnab.me> | 2020-04-21 14:07:15 +0000 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-04-21 14:08:28 +0000 |
commit | be0a2bae8112de1d4674767c5c60e296c28e8532 (patch) | |
tree | 84211f371693c9085caf6bf27c6bae715dbdd599 /src/table_sync.rs | |
parent | cc4f2f1cfb30e3995edf3c1174bd06b4bc0a9bf1 (diff) | |
download | garage-be0a2bae8112de1d4674767c5c60e296c28e8532.tar.gz garage-be0a2bae8112de1d4674767c5c60e296c28e8532.zip |
Add node tags in configuration
Diffstat (limited to 'src/table_sync.rs')
-rw-r--r-- | src/table_sync.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/table_sync.rs b/src/table_sync.rs index cb6d87aa..26c5bed8 100644 --- a/src/table_sync.rs +++ b/src/table_sync.rs @@ -198,19 +198,25 @@ where partition: &TodoPartition, must_exit: &mut watch::Receiver<bool>, ) -> Result<(), Error> { - debug!("({}) Preparing to sync {:?}...", self.table.name, partition); - let root_cks = self - .root_checksum(&partition.begin, &partition.end, must_exit) - .await?; - let my_id = self.table.system.id.clone(); let nodes = self .table .replication - .write_nodes(&partition.begin, &self.table.system); + .write_nodes(&partition.begin, &self.table.system) + .into_iter() + .filter(|node| *node != my_id) + .collect::<Vec<_>>(); + + debug!( + "({}) Preparing to sync {:?} with {:?}...", + self.table.name, partition, nodes + ); + let root_cks = self + .root_checksum(&partition.begin, &partition.end, must_exit) + .await?; + let mut sync_futures = nodes .iter() - .filter(|node| **node != my_id) .map(|node| { self.clone().do_sync_with( partition.clone(), @@ -230,7 +236,10 @@ where } } if n_errors > self.table.replication.max_write_errors() { - return Err(Error::Message(format!("Sync failed with too many nodes."))); + return Err(Error::Message(format!( + "Sync failed with too many nodes (should have been: {:?}).", + nodes + ))); } if !partition.retain { |