aboutsummaryrefslogtreecommitdiff
path: root/src/garage
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-03-15 15:26:29 +0100
committerAlex Auvolat <alex@adnab.me>2021-03-15 15:26:29 +0100
commit097c339d981dba0420af17d30d1221181d8bf1d7 (patch)
tree0d91832b3fb89b95bb4341ca580619f7081378a9 /src/garage
parentbdcbdd1cd854bd8125458af0ac20b8682f810967 (diff)
downloadgarage-097c339d981dba0420af17d30d1221181d8bf1d7.tar.gz
garage-097c339d981dba0420af17d30d1221181d8bf1d7.zip
Fix race condition
Diffstat (limited to 'src/garage')
-rw-r--r--src/garage/repair.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/garage/repair.rs b/src/garage/repair.rs
index 47fc1ae1..599c1965 100644
--- a/src/garage/repair.rs
+++ b/src/garage/repair.rs
@@ -82,13 +82,7 @@ impl Repair {
.versions()
.iter()
.any(|x| x.uuid == version.uuid && x.state != ObjectVersionState::Aborted),
- None => {
- warn!(
- "Repair versions: object for version {:?} not found, skipping.",
- version
- );
- continue;
- }
+ None => false,
};
if !version_exists {
info!("Repair versions: marking version as deleted: {:?}", version);
@@ -127,16 +121,8 @@ impl Repair {
.version_table
.get(&block_ref.version, &EmptyKey)
.await?;
- let ref_exists = match version {
- Some(v) => !v.deleted.get(),
- None => {
- warn!(
- "Block ref repair: version for block ref {:?} not found, skipping.",
- block_ref
- );
- continue;
- }
- };
+ // The version might not exist if it has been GC'ed
+ let ref_exists = version.map(|v| !v.deleted.get()).unwrap_or(false);
if !ref_exists {
info!(
"Repair block ref: marking block_ref as deleted: {:?}",