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.
This commit is contained in:
Joonas Koivunen
2023-10-25 14:59:43 +03:00
committed by GitHub
parent 127837abb0
commit c5949e1fd6
3 changed files with 7 additions and 2 deletions

View File

@@ -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)
}

View File

@@ -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) =

View File

@@ -3079,6 +3079,7 @@ impl Timeline {
Ok(false)
}
#[tracing::instrument(skip_all, fields(%lsn, %force))]
async fn create_image_layers(
&self,
partitioning: &KeyPartitioning,