Skip to content

Commit

Permalink
fix: Fix reserialization dropping data sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Sep 10, 2023
1 parent deed90a commit cea619f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion wnfs-hamt/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ where
);

let node = Rc::make_mut(self);
node.persisted_as = OnceCell::new();

// If the bit is not set yet, insert a new pointer.
if !node.bitmask[bit_index] {
Expand Down Expand Up @@ -458,7 +459,10 @@ where
}

let value_index = self.get_value_index(bit_index);
match &mut Rc::make_mut(self).pointers[value_index] {
let node = Rc::make_mut(self);
node.persisted_as = OnceCell::new();

match &mut node.pointers[value_index] {
Pointer::Values(values) => Ok({
values
.iter_mut()
Expand Down Expand Up @@ -495,6 +499,7 @@ where
let value_index = self.get_value_index(bit_index);

let node = Rc::make_mut(self);
node.persisted_as = OnceCell::new();

Ok(match &mut node.pointers[value_index] {
// If there is only one value, we can remove the entire pointer.
Expand Down

1 comment on commit cea619f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: cea619f Previous: e6cee87 Ratio
node set 78725 ns/iter (± 1116) 8645 ns/iter (± 754) 9.11

This comment was automatically generated by workflow using github-action-benchmark.

CC: @wnfs-wg/fission

Please sign in to comment.