From 48395d7fe105a6cf75d720fade6d4d2e20ff3531 Mon Sep 17 00:00:00 2001 From: Ron Kuris Date: Wed, 9 Oct 2024 12:19:31 -1000 Subject: [PATCH] Must delete from context of latest revision (#732) --- firewood/src/manager.rs | 4 ++-- storage/src/nodestore.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/firewood/src/manager.rs b/firewood/src/manager.rs index d2b8bfcfd..962191ee9 100644 --- a/firewood/src/manager.rs +++ b/firewood/src/manager.rs @@ -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 @@ -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); diff --git a/storage/src/nodestore.rs b/storage/src/nodestore.rs index b7156aa39..32cff965c 100644 --- a/storage/src/nodestore.rs +++ b/storage/src/nodestore.rs @@ -1132,12 +1132,12 @@ where impl NodeStore { /// 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) -> 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(()) }