Truncate waltmp file on creation (#8133)

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.
This commit is contained in:
Arthur Petukhovsky
2024-06-24 15:07:59 +01:00
committed by GitHub
parent 47fdf93cf0
commit a4db2af1f0

View File

@@ -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))?;