Skip to content

Commit

Permalink
Fix using written size bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fangpenlin committed Jan 9, 2025
1 parent f8168ae commit 7a2edd2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/benchmarks/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ impl StorageBenchmark {
.open(&self.path)?;
while true {
let chunk_size = min(self.chunk_size, remaining_size);
let written = file.write(&buf[..chunk_size])?;
remaining_size -= written;
let _written = file.write(&buf[..chunk_size])?;
// Notice: somehow there's a bug or what making written size returning 0, which is
// obviously wrong. Before we fix that, we just calculate the remaining_size
// based on the size we have written
remaining_size -= chunk_size;
}
file.sync_all();
let end = SystemTime::now();
Expand Down

0 comments on commit 7a2edd2

Please sign in to comment.