From fa6155ef95dc02bd34d4546797ab112cfe90c46a Mon Sep 17 00:00:00 2001 From: Dan Laine Date: Fri, 29 Mar 2024 15:23:20 -0400 Subject: [PATCH] clean up `delete_descriptor` (#616) --- firewood/src/shale/compact.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/firewood/src/shale/compact.rs b/firewood/src/shale/compact.rs index 6f63d79f5..458089cb8 100644 --- a/firewood/src/shale/compact.rs +++ b/firewood/src/shale/compact.rs @@ -321,15 +321,13 @@ impl StoreInner { } fn delete_descriptor(&mut self, desc_addr: DiskAddress) -> Result<(), ShaleError> { - let desc_size = ChunkDescriptor::SERIALIZED_LEN; // TODO: subtracting two disk addresses is only used here, probably can rewrite this - // debug_assert!((desc_addr.0 - self.header.base_addr.value.into()) % desc_size == 0); - + // debug_assert!((desc_addr.0 - self.header.base_addr.value.into()) % ChunkDescriptor::SERIALIZED_LEN == 0); // Move the last descriptor to the position of the deleted descriptor #[allow(clippy::unwrap_used)] self.header .meta_store_tail - .modify(|r| *r -= desc_size as usize) + .modify(|r| *r -= ChunkDescriptor::SERIALIZED_LEN as usize) .unwrap(); if desc_addr != DiskAddress(**self.header.meta_store_tail) {