From 2c6c8ed6881c10ced3cbccd9c3747fe32fedba4e Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Sat, 25 Nov 2017 23:26:36 -0500 Subject: [PATCH] Fix rm log not getting written to disk Only the temporary remove log for the last block was written to disk, and then overwritten for every block. The fix writes the temp remove log (just last block) to the permanent remove log, and saves that to disk. --- store/src/sumtree.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/store/src/sumtree.rs b/store/src/sumtree.rs index d3a60d242..55f91fd12 100644 --- a/store/src/sumtree.rs +++ b/store/src/sumtree.rs @@ -215,11 +215,13 @@ impl RemoveLog { match self.removed.binary_search(&elmt) { Ok(_) => continue, Err(idx) => { - file.write_all(&ser::ser_vec(&elmt).unwrap()[..])?; self.removed.insert(idx, *elmt); } } } + for elmt in &self.removed { + file.write_all(&ser::ser_vec(&elmt).unwrap()[..])?; + } self.removed_tmp = vec![]; file.sync_data() }