From 08558b83ed0b904034cacd23fdd87304a59b32d0 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Wed, 3 May 2023 19:38:05 +0200 Subject: [PATCH] improve XXX above remove_dir_all regarding atomicity With this PR, we're now atomic, if remote storage is configured. --- pageserver/src/tenant.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index 76f93b8cfd..abea1551dd 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -1446,8 +1446,12 @@ impl Tenant { Err(anyhow::anyhow!("failpoint: timeline-delete-before-rm"))? }); - // XXX make this atomic so that, if we crash-mid-way, the timeline won't be picked up - // with some layers missing. + // NB: This need not be atomic because the deleted flag in the IndexPart + // will be observed during tenant/timeline load. The deletion will be resumed there. + // + // For configurations without remote storage, we tolerate that we're not crash-safe here. + // The timeline may come up Active but with missing layer files, in such setups. + // See https://github.com/neondatabase/neon/pull/3919#issuecomment-1531726720 std::fs::remove_dir_all(&local_timeline_directory).with_context(|| { format!( "Failed to remove local timeline directory '{}'",