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.
This commit is contained in:
Ignotus Peverell 2017-11-25 23:26:36 -05:00
parent 0fb15641fe
commit 2c6c8ed688
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211

View file

@ -215,11 +215,13 @@ impl RemoveLog {
match self.removed.binary_search(&elmt) { match self.removed.binary_search(&elmt) {
Ok(_) => continue, Ok(_) => continue,
Err(idx) => { Err(idx) => {
file.write_all(&ser::ser_vec(&elmt).unwrap()[..])?;
self.removed.insert(idx, *elmt); self.removed.insert(idx, *elmt);
} }
} }
} }
for elmt in &self.removed {
file.write_all(&ser::ser_vec(&elmt).unwrap()[..])?;
}
self.removed_tmp = vec![]; self.removed_tmp = vec![];
file.sync_data() file.sync_data()
} }