From aa4763bed1a11e511acdf03d0adb0f9c335acbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arpad=20M=C3=BCller?= Date: Fri, 1 Sep 2023 14:18:34 +0200 Subject: [PATCH] Use write_and_fsync in persist_tenant_config --- pageserver/src/tenant.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index bd1948983e..d814d066fb 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -34,7 +34,6 @@ use std::fs; use std::fs::File; use std::fs::OpenOptions; use std::io; -use std::io::Write; use std::ops::Bound::Included; use std::path::Path; use std::path::PathBuf; @@ -2469,10 +2468,8 @@ impl Tenant { )?; target_config_file - .write(conf_content.as_bytes()) - .context("write toml bytes into file") - .and_then(|_| target_config_file.sync_all().context("fsync config file")) - .context("write config file")?; + .write_and_fsync(conf_content.as_bytes()) + .context("write tenant config toml bytes into file")?; // fsync the parent directory to ensure the directory entry is durable. // before this was done conditionally on creating_tenant, but these management actions are rare