Skip to content

Commit

Permalink
fix bug: delete file if partial write was detected
Browse files Browse the repository at this point in the history
  • Loading branch information
lquenti committed Feb 26, 2024
1 parent f12d621 commit 5ab510d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions blackheap/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ pub fn save_and_update_progress(
);
let file_path = format!("{}/{}.txt", &dir, access_size,);
fs::create_dir_all(dir)?;

/* If it already exists but we did still benchmark, it was most likely interrupted while writing... */
if Path::new(&file_path).exists() {
fs::remove_file(&file_path)?;
}

File::create(&file_path)?;

/* we save it as newline seperated f64s */
Expand Down
1 change: 1 addition & 0 deletions blackheap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fn main() {
for b in benchmarks.iter() {
/* Which access sizes do we still have to do? */
let missing_access_sizes = {
/* To make the borrow checker happy */
let tmp_progress = progress.clone();
tmp_progress
.get_missing_access_sizes(b)
Expand Down

0 comments on commit 5ab510d

Please sign in to comment.