forked from Deuxfleurs/garage
I was tired yesterday
This commit is contained in:
parent
a52ab69640
commit
09fd6ea7f0
2 changed files with 10 additions and 3 deletions
|
@ -433,7 +433,7 @@ where
|
||||||
let removed = self.store.transaction(|txn| {
|
let removed = self.store.transaction(|txn| {
|
||||||
if let Some(cur_v) = txn.get(k)? {
|
if let Some(cur_v) = txn.get(k)? {
|
||||||
if cur_v == v {
|
if cur_v == v {
|
||||||
txn.remove(v)?;
|
txn.remove(k)?;
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
counter += 1;
|
counter += 1;
|
||||||
debug!("Offloading items from {:?}..{:?} ({})", begin, end, counter);
|
debug!("Offloading {} items from {:?}..{:?} ({})", items.len(), begin, end, counter);
|
||||||
self.offload_items(&items, &nodes[..]).await?;
|
self.offload_items(&items, &nodes[..]).await?;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -348,8 +348,15 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// All remote nodes have written those items, now we can delete them locally
|
// All remote nodes have written those items, now we can delete them locally
|
||||||
|
let mut not_removed = 0;
|
||||||
for (k, v) in items.iter() {
|
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(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue