From 593c2fc8164a5ed48654774e861c4ea4a67f63fd Mon Sep 17 00:00:00 2001 From: idruzhitskiy Date: Wed, 27 Apr 2022 15:19:58 +0300 Subject: [PATCH] 166 fix delete (#167) * fix delete * update changelog * Update CHANGELOG.md --- CHANGELOG.md | 1 + src/storage/core.rs | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbac0fabf6..ca475e16bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Pearl changelog #### Changed #### Fixed +- Fix delete with no active blob set (#167) #### Updated diff --git a/src/storage/core.rs b/src/storage/core.rs index 974648d2a2..790ab377e5 100644 --- a/src/storage/core.rs +++ b/src/storage/core.rs @@ -682,7 +682,7 @@ where ErrorKind::Bincode(_) => true, ErrorKind::Validation { kind, cause: _ } => { !matches!(kind, ValidationErrorKind::BlobVersion) - }, + } _ => false, }; } @@ -873,12 +873,14 @@ where async fn mark_all_as_deleted_active(&self, key: &K) -> Result { 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) } }