From db3dc069161213ab2f75d3126832b8e100f15354 Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 6 Sep 2023 13:42:58 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Joonas Koivunen --- control_plane/src/attachment_service.rs | 2 +- control_plane/src/bin/attachment_service.rs | 4 ++-- pageserver/src/tenant/mgr.rs | 4 ++-- pageserver/src/tenant/remote_timeline_client.rs | 2 +- pageserver/src/tenant/remote_timeline_client/download.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/control_plane/src/attachment_service.rs b/control_plane/src/attachment_service.rs index 9a6a79844cd7..2bd4260aa8ce 100644 --- a/control_plane/src/attachment_service.rs +++ b/control_plane/src/attachment_service.rs @@ -97,7 +97,7 @@ impl AttachmentService { let response = client.post(url).json(&request).send()?; if response.status() != StatusCode::OK { - return Err(anyhow!("Unexpected status {0}", response.status())); + return Err(anyhow!("Unexpected status {}", response.status())); } let response = response.json::()?; diff --git a/control_plane/src/bin/attachment_service.rs b/control_plane/src/bin/attachment_service.rs index ec800087a226..e879646b637b 100644 --- a/control_plane/src/bin/attachment_service.rs +++ b/control_plane/src/bin/attachment_service.rs @@ -112,7 +112,7 @@ impl PersistentState { async fn load_or_new(path: &Path) -> Self { match Self::load(path).await { Ok(s) => { - tracing::info!("Loaded state file at {0}", path.display()); + tracing::info!("Loaded state file at {}", path.display()); s } Err(e) @@ -120,7 +120,7 @@ impl PersistentState { .map(|e| e.kind() == std::io::ErrorKind::NotFound) .unwrap_or(false) => { - tracing::info!("Will create state file at {0}", path.display()); + tracing::info!("Will create state file at {}", path.display()); Self { tenants: HashMap::new(), path: path.to_owned(), diff --git a/pageserver/src/tenant/mgr.rs b/pageserver/src/tenant/mgr.rs index 9548e0885e32..b92c1f69c3ff 100644 --- a/pageserver/src/tenant/mgr.rs +++ b/pageserver/src/tenant/mgr.rs @@ -169,7 +169,7 @@ pub async fn init_tenant_mgr( Ok(id) => id, Err(_) => { warn!( - "Invalid tenant path (garbage in our repo directory?): {0}", + "Invalid tenant path (garbage in our repo directory?): {}", tenant_dir_path.display() ); continue; @@ -182,7 +182,7 @@ pub async fn init_tenant_mgr( if let Some(gen) = generations.get(&tenant_id) { *gen } else { - info!("Detaching tenant {0}, control plane omitted it in re-attach response", tenant_id); + info!("Detaching tenant {tenant_id}, control plane omitted it in re-attach response"); if let Err(e) = safe_remove_tenant_dir_all(&tenant_dir_path).await { error!( "Failed to remove detached tenant directory '{}': {:?}", diff --git a/pageserver/src/tenant/remote_timeline_client.rs b/pageserver/src/tenant/remote_timeline_client.rs index 3dcd95ed5f50..6f42b54ac2ae 100644 --- a/pageserver/src/tenant/remote_timeline_client.rs +++ b/pageserver/src/tenant/remote_timeline_client.rs @@ -1431,7 +1431,7 @@ pub fn remote_index_path( } /// Given the key of an index, parse out the generation part of the name -pub fn parse_remote_index_path(path: RemotePath) -> Option { +pub(crate) fn parse_remote_index_path(path: RemotePath) -> Option { let file_name = match path.get_path().file_name() { Some(f) => f, None => { diff --git a/pageserver/src/tenant/remote_timeline_client/download.rs b/pageserver/src/tenant/remote_timeline_client/download.rs index 1dd701a1adc0..986321552906 100644 --- a/pageserver/src/tenant/remote_timeline_client/download.rs +++ b/pageserver/src/tenant/remote_timeline_client/download.rs @@ -316,7 +316,7 @@ pub(super) async fn download_index_part( } // General case/fallback: if there is no index at my_generation or prev_generation, then list all index_part.json - // objects, and select the highest one with a generation < my_generation. + // objects, and select the highest one with a generation <= my_generation. let index_prefix = remote_index_path(tenant_id, timeline_id, Generation::none()); let indices = backoff::retry( || async { storage.list_files(Some(&index_prefix)).await },