Skip to content

Commit

Permalink
clean up delete_descriptor (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Laine authored Mar 29, 2024
1 parent e157967 commit fa6155e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions firewood/src/shale/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,13 @@ impl<M: LinearStore> StoreInner<M> {
}

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) {
Expand Down

0 comments on commit fa6155e

Please sign in to comment.