From c4ebaab59ebb4dc02cdbc8370418ece68643ee3b Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 28 Nov 2024 13:15:01 +0800 Subject: [PATCH] empty if exists Signed-off-by: Bugen Zhao --- src/risedevtool/src/task/meta_node_service.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/risedevtool/src/task/meta_node_service.rs b/src/risedevtool/src/task/meta_node_service.rs index 53b8bb85ab974..6692d701e3a3e 100644 --- a/src/risedevtool/src/task/meta_node_service.rs +++ b/src/risedevtool/src/task/meta_node_service.rs @@ -370,7 +370,9 @@ fn initialize_meta_store() -> Result<(), anyhow::Error> { // SQLite in-memory database does not need initialization. } else { let filename = options.get_filename(); - fs_err::write(filename, b"").context("failed to empty SQLite file")?; + if std::fs::exists(filename)? { + fs_err::write(filename, b"").context("failed to empty SQLite file")?; + } } return Ok(());