From cbd00d7ed91e4b4cd95d3e2e40b16a06e73613ff Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Wed, 18 May 2022 23:46:38 +0300 Subject: [PATCH] Remove temp layer files during timeline initialization on pageserver start --- pageserver/src/storage_sync.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pageserver/src/storage_sync.rs b/pageserver/src/storage_sync.rs index 39459fafc6..bbebcd1f36 100644 --- a/pageserver/src/storage_sync.rs +++ b/pageserver/src/storage_sync.rs @@ -421,6 +421,14 @@ fn collect_timeline_files( entry_path.display() ) })?; + } else if entry_path.extension().and_then(OsStr::to_str) == Some("temp") { + info!("removing temp layer file at {}", entry_path.display()); + std::fs::remove_file(&entry_path).with_context(|| { + format!( + "failed to remove temp layer file at {}", + entry_path.display() + ) + })?; } else { timeline_files.insert(entry_path); }