Skip to content

Commit

Permalink
Truncate waltmp file on creation (#8133)
Browse files Browse the repository at this point in the history
Previously in safekeeper code, new segment file was opened without
truncate option. I don't think there is a reason to do it, this commit
replaces it with `File::create` to make it simpler and remove
`clippy::suspicious_open_options` linter warning.
  • Loading branch information
petuhovskiy authored and conradludgate committed Jun 27, 2024
1 parent b703b23 commit cc5c663
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions safekeeper/src/wal_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,7 @@ impl PhysicalStorage {
// half initialized segment, first bake it under tmp filename and
// then rename.
let tmp_path = self.timeline_dir.join("waltmp");
#[allow(clippy::suspicious_open_options)]
let mut file = OpenOptions::new()
.create(true)
.write(true)
.open(&tmp_path)
let mut file = File::create(&tmp_path)
.await
.with_context(|| format!("Failed to open tmp wal file {:?}", &tmp_path))?;

Expand Down

0 comments on commit cc5c663

Please sign in to comment.