From c5949e1fd6de8a98ef70442c416db1a69cfd44f1 Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Wed, 25 Oct 2023 14:59:43 +0300 Subject: [PATCH] misc smaller improvements (#5527) - finally add an `#[instrument]` to Timeline::create_image_layers, making it easier to see that something is happening because we create image layers - format some macro context code - add a warning not to create new validation functions a la parse do not validate Split off from #5198. --- pageserver/src/lib.rs | 4 ++++ pageserver/src/tenant.rs | 4 ++-- pageserver/src/tenant/timeline.rs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pageserver/src/lib.rs b/pageserver/src/lib.rs index 32d43053bd..e71130e8af 100644 --- a/pageserver/src/lib.rs +++ b/pageserver/src/lib.rs @@ -149,6 +149,10 @@ fn ends_with_suffix(path: &Utf8Path, suffix: &str) -> bool { } } +// FIXME: DO NOT ADD new query methods like this, which will have a next step of parsing timelineid +// from the directory name. Instead create type "UninitMark(TimelineId)" and only parse it once +// from the name. + pub fn is_uninit_mark(path: &Utf8Path) -> bool { ends_with_suffix(path, TIMELINE_UNINIT_MARK_SUFFIX) } diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index 82f82dcd09..f8895c32dc 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -1057,8 +1057,8 @@ impl Tenant { TimelineId::try_from(timeline_uninit_mark_file.file_stem()) .with_context(|| { format!( - "Could not parse timeline id out of the timeline uninit mark name {timeline_uninit_mark_file}", - ) + "Could not parse timeline id out of the timeline uninit mark name {timeline_uninit_mark_file}", + ) })?; let timeline_dir = self.conf.timeline_path(&self.tenant_id, &timeline_id); if let Err(e) = diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 8ce6aa2108..201541244a 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -3079,6 +3079,7 @@ impl Timeline { Ok(false) } + #[tracing::instrument(skip_all, fields(%lsn, %force))] async fn create_image_layers( &self, partitioning: &KeyPartitioning,