Commit 3902e920 authored by Nils Goroll's avatar Nils Goroll

directors.shard: fix hole handling during recondiguration

parent 1226e77f
...@@ -355,10 +355,15 @@ shardcfg_backend_lookup(const struct backend_reconfig *re, ...@@ -355,10 +355,15 @@ shardcfg_backend_lookup(const struct backend_reconfig *re,
unsigned i, max = re->shardd->n_backend + re->hole_n; unsigned i, max = re->shardd->n_backend + re->hole_n;
const struct shard_backend *bb = re->shardd->backend; const struct shard_backend *bb = re->shardd->backend;
for (i = 0; i < max; i++) if (max > 0)
AN(bb);
for (i = 0; i < max; i++) {
if (bb[i].backend == NULL)
continue; // hole
if (!shardcfg_backend_cmp(b, &bb[i])) if (!shardcfg_backend_cmp(b, &bb[i]))
return &bb[i]; return &bb[i];
}
return NULL; return NULL;
} }
...@@ -434,6 +439,8 @@ shardcfg_backend_del(struct backend_reconfig *re, ...@@ -434,6 +439,8 @@ shardcfg_backend_del(struct backend_reconfig *re,
struct shard_backend * const bb = re->shardd->backend; struct shard_backend * const bb = re->shardd->backend;
for (i = 0; i < max; i++) { for (i = 0; i < max; i++) {
if (bb[i].backend == NULL)
continue; // hole
if (shardcfg_backend_del_cmp(spec, &bb[i])) if (shardcfg_backend_del_cmp(spec, &bb[i]))
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment