Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Joonas Koivunen <[email protected]>
  • Loading branch information
jcsp and koivunej authored Sep 6, 2023
1 parent 606a392 commit db3dc06
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion control_plane/src/attachment_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<AttachHookResponse>()?;
Expand Down
4 changes: 2 additions & 2 deletions control_plane/src/bin/attachment_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ 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)
if e.downcast_ref::<std::io::Error>()
.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(),
Expand Down
4 changes: 2 additions & 2 deletions pageserver/src/tenant/mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 '{}': {:?}",
Expand Down
2 changes: 1 addition & 1 deletion pageserver/src/tenant/remote_timeline_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Generation> {
pub(crate) fn parse_remote_index_path(path: RemotePath) -> Option<Generation> {
let file_name = match path.get_path().file_name() {
Some(f) => f,
None => {
Expand Down
2 changes: 1 addition & 1 deletion pageserver/src/tenant/remote_timeline_client/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit db3dc06

Please sign in to comment.