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 committed Jun 24, 2024
1 parent 47fdf93 commit a4db2af
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

1 comment on commit a4db2af

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3004 tests run: 2878 passed, 0 failed, 126 skipped (full report)


Code coverage* (full report)

  • functions: 32.5% (6870 of 21131 functions)
  • lines: 50.0% (53385 of 106768 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
a4db2af at 2024-06-24T15:36:40.518Z :recycle:

Please sign in to comment.