Skip to content

Commit

Permalink
166 fix delete (#167)
Browse files Browse the repository at this point in the history
* fix delete

* update changelog

* Update CHANGELOG.md
  • Loading branch information
idruzhitskiy authored Apr 27, 2022
1 parent a51a10a commit 593c2fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Pearl changelog
#### Changed

#### Fixed
- Fix delete with no active blob set (#167)

#### Updated

Expand Down
16 changes: 9 additions & 7 deletions src/storage/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ where
ErrorKind::Bincode(_) => true,
ErrorKind::Validation { kind, cause: _ } => {
!matches!(kind, ValidationErrorKind::BlobVersion)
},
}
_ => false,
};
}
Expand Down Expand Up @@ -873,12 +873,14 @@ where

async fn mark_all_as_deleted_active(&self, key: &K) -> Result<u64> {
let mut safe = self.inner.safe.write().await;
let active_blob = safe
.active_blob
.as_deref_mut()
.ok_or_else(Error::active_blob_not_set)?;
let count = active_blob.mark_all_as_deleted(key).await?.unwrap_or(0);
debug!("{} deleted from active blob", count);
let active_blob = safe.active_blob.as_deref_mut();
let count = if let Some(active_blob) = active_blob {
let count = active_blob.mark_all_as_deleted(key).await?.unwrap_or(0);
debug!("{} deleted from active blob", count);
count
} else {
0
};
Ok(count)
}
}
Expand Down

0 comments on commit 593c2fc

Please sign in to comment.