From 09fd6ea7f02f5e8a7642942c52227056464b8833 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 24 Feb 2021 11:05:59 +0100 Subject: [PATCH] I was tired yesterday --- src/table/table.rs | 2 +- src/table/table_sync.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/table/table.rs b/src/table/table.rs index bcf407ec..8b16173e 100644 --- a/src/table/table.rs +++ b/src/table/table.rs @@ -433,7 +433,7 @@ where let removed = self.store.transaction(|txn| { if let Some(cur_v) = txn.get(k)? { if cur_v == v { - txn.remove(v)?; + txn.remove(k)?; return Ok(true); } } diff --git a/src/table/table_sync.rs b/src/table/table_sync.rs index 58391274..2c984226 100644 --- a/src/table/table_sync.rs +++ b/src/table/table_sync.rs @@ -319,7 +319,7 @@ where } counter += 1; - debug!("Offloading items from {:?}..{:?} ({})", begin, end, counter); + debug!("Offloading {} items from {:?}..{:?} ({})", items.len(), begin, end, counter); self.offload_items(&items, &nodes[..]).await?; } else { break; @@ -348,8 +348,15 @@ where } // All remote nodes have written those items, now we can delete them locally + let mut not_removed = 0; for (k, v) in items.iter() { - self.table.delete_if_equal(&k[..], &v[..])?; + if !self.table.delete_if_equal(&k[..], &v[..])? { + not_removed += 1; + } + } + + if not_removed > 0 { + debug!("{} items not removed during offload because they changed in between (trying again...)", not_removed); } Ok(())