diff --git a/control_plane/src/bin/attachment_service.rs b/control_plane/src/bin/attachment_service.rs index 778b2537a6..a00e03777b 100644 --- a/control_plane/src/bin/attachment_service.rs +++ b/control_plane/src/bin/attachment_service.rs @@ -281,18 +281,18 @@ impl TenantState { let node = pageservers .get(&node_id) .expect("Pageserver may not be removed while referenced"); - self.location_config(&node, wanted_conf).await?; + self.location_config(node, wanted_conf).await?; } } } None => { // Detach everything - for (node_id, _old_state) in &self.observed.locations { + for node_id in self.observed.locations.keys() { let node = pageservers .get(node_id) .expect("Pageserver may not be removed while referenced"); self.location_config( - &node, + node, LocationConfig { mode: LocationConfigMode::Detached, generation: None, @@ -474,11 +474,11 @@ struct Scheduler { impl Scheduler { fn new(persistent_state: &PersistentState) -> Self { let mut tenant_counts = HashMap::new(); - for (node_id, _) in &persistent_state.pageservers { + for node_id in persistent_state.pageservers.keys() { tenant_counts.insert(*node_id, 0); } - for (_id, tenant) in &persistent_state.tenants { + for tenant in persistent_state.tenants.values() { if let Some(ps) = tenant.pageserver { let entry = tenant_counts.entry(ps).or_insert(0); *entry += 1; @@ -840,7 +840,7 @@ async fn handle_tenant_shard_split(mut req: Request) -> Result TenantConfOpt { - self.tenant_conf.read().unwrap().tenant_conf.clone() + self.tenant_conf.read().unwrap().tenant_conf } } diff --git a/pageserver/src/tenant/config.rs b/pageserver/src/tenant/config.rs index 3316cc009f..12be2b0931 100644 --- a/pageserver/src/tenant/config.rs +++ b/pageserver/src/tenant/config.rs @@ -175,7 +175,7 @@ impl LocationConf { generation, attach_mode: AttachmentMode::Single, }), - shard: ShardIdentity::from_params(ShardNumber(0), &shard_params), + shard: ShardIdentity::from_params(ShardNumber(0), shard_params), tenant_conf, } } diff --git a/pageserver/src/tenant/mgr.rs b/pageserver/src/tenant/mgr.rs index dd317df6ea..7c17135ca3 100644 --- a/pageserver/src/tenant/mgr.rs +++ b/pageserver/src/tenant/mgr.rs @@ -1128,7 +1128,7 @@ impl TenantManager { anyhow::bail!("Requested shard count is not an increase"); } let expansion_factor = new_shard_count.0 / effective_old_shard_count; - if !(expansion_factor & (expansion_factor - 1) == 0) { + if expansion_factor & (expansion_factor - 1) != 0 { anyhow::bail!("Requested split is not a power of two"); }