Skip to content

Commit

Permalink
Must delete from context of latest revision (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuris authored Oct 9, 2024
1 parent 6da66b9 commit 48395d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions firewood/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl RevisionManager {
return Err(RevisionManagerError::NotLatest);
}

let committed = proposal.as_committed();
let mut committed = proposal.as_committed();

// 2. Persist delete list for this committed revision to disk for recovery

Expand All @@ -162,7 +162,7 @@ impl RevisionManager {
// This guarantee is there because we have a `&mut self` reference to the manager, so
// the compiler guarantees we are the only one using this manager.
match Arc::try_unwrap(oldest) {
Ok(oldest) => oldest.reap_deleted()?,
Ok(oldest) => oldest.reap_deleted(&mut committed)?,
Err(original) => {
warn!("Oldest revision could not be reaped; still referenced");
self.historical.push_front(original);
Expand Down
4 changes: 2 additions & 2 deletions storage/src/nodestore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,12 +1132,12 @@ where

impl<S: WritableStorage> NodeStore<Committed, S> {
/// adjust the freelist of this proposal to reflect the freed nodes in the oldest proposal
pub fn reap_deleted(mut self) -> Result<(), Error> {
pub fn reap_deleted(mut self, proposal: &mut NodeStore<Committed, S>) -> Result<(), Error> {
self.storage
.invalidate_cached_nodes(self.kind.deleted.iter());
trace!("There are {} nodes to reap", self.kind.deleted.len());
for addr in take(&mut self.kind.deleted) {
self.delete_node(addr)?;
proposal.delete_node(addr)?;
}
Ok(())
}
Expand Down

0 comments on commit 48395d7

Please sign in to comment.