This commit is contained in:
John Spray
2023-12-12 17:14:43 +00:00
parent d1af9d480e
commit 495c3d70f3
5 changed files with 12 additions and 12 deletions

View File

@@ -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<Body>) -> Result<Response<Bo
tenant_shard_id: child,
shard: child_shard,
pageserver: Some(pageserver),
generation: generation,
generation,
observed: ObservedState {
locations: child_observed,
},

View File

@@ -607,7 +607,7 @@ async fn handle_timeline(timeline_match: &ArgMatches, env: &mut local_env::Local
let attachment_service = AttachmentService::from_env(env);
let create_req = TimelineCreateRequest {
new_timeline_id: new_timeline_id,
new_timeline_id,
ancestor_timeline_id: None,
existing_initdb_timeline_id: None,
ancestor_start_lsn: None,
@@ -699,7 +699,7 @@ async fn handle_timeline(timeline_match: &ArgMatches, env: &mut local_env::Local
let new_timeline_id = TimelineId::generate();
let attachment_service = AttachmentService::from_env(env);
let create_req = TimelineCreateRequest {
new_timeline_id: new_timeline_id,
new_timeline_id,
ancestor_timeline_id: Some(ancestor_timeline_id),
existing_initdb_timeline_id: None,
ancestor_start_lsn: start_lsn,

View File

@@ -2353,7 +2353,7 @@ impl Tenant {
for child_shard in child_shards {
upload_index_part(
&remote_storage,
remote_storage,
child_shard,
&timeline.timeline_id,
self.generation,
@@ -3684,7 +3684,7 @@ impl Tenant {
}
pub(crate) fn get_tenant_conf(&self) -> TenantConfOpt {
self.tenant_conf.read().unwrap().tenant_conf.clone()
self.tenant_conf.read().unwrap().tenant_conf
}
}

View File

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

View File

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