Fix notify_local shard count

This commit is contained in:
Erik Grinaker
2025-07-23 11:16:35 +02:00
parent f7e403eea1
commit eaec6e2fb4

View File

@@ -509,7 +509,11 @@ impl ApiMethod for ComputeHookTenant {
if endpoint.tenant_id == *tenant_id && endpoint.status() == EndpointStatus::Running {
tracing::info!("Reconfiguring pageservers for endpoint {endpoint_name}");
let shard_count = ShardCount(shards.len().try_into().expect("too many shards"));
let shard_count = match shards.len() {
0 => panic!("no shards"),
1 => ShardCount::unsharded(),
n => ShardCount(n.try_into().expect("too many shards")),
};
let mut shard_infos: HashMap<ShardIndex, PageserverShardInfo> = HashMap::new();
@@ -556,7 +560,7 @@ impl ApiMethod for ComputeHookTenant {
}
let pageserver_conninfo = PageserverConnectionInfo {
shard_count: ShardCount::unsharded(),
shard_count,
stripe_size: stripe_size.map(|val| val.0),
shards: shard_infos,
prefer_protocol,