Skip to content

Commit

Permalink
fix(repair): fix repair plan host filtering
Browse files Browse the repository at this point in the history
Fixes #3736
  • Loading branch information
Michal-Leszczynski committed Mar 6, 2024
1 parent cbe3110 commit 2bca285
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions pkg/service/repair/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,32 @@ func newPlan(ctx context.Context, target Target, client *scyllaclient.Client) (*
}

skip := false
for _, rep := range ring.ReplicaTokens {
rtr := scyllaclient.ReplicaTokenRanges{
ReplicaSet: filteredReplicaSet(rep.ReplicaSet, filtered, target.Host),
Ranges: rep.Ranges,
for _, rtr := range ring.ReplicaTokens {
// Skip the whole keyspace based on repaired dcs only
// (unless it's a single node cluster).
replicas := 0
for _, h := range rtr.ReplicaSet {
if slice.ContainsString(target.DC, ring.HostDC[h]) {
replicas++
}
}

// Don't add keyspace with some ranges not replicated in filtered hosts,
// unless it's a single node cluster.
if len(rtr.ReplicaSet) <= 1 && len(status) > 1 {
if replicas <= 1 && len(status) > 1 {
skip = true
break
}
// Skip given replica sets based on all filtering factors
rtr.ReplicaSet = filteredReplicaSet(rtr.ReplicaSet, filtered, target.Host)
if len(rtr.ReplicaSet) <= 1 {
continue
}

for _, r := range rtr.Ranges {
kp.TokenRepIdx[r] = len(kp.Replicas)
}
kp.Replicas = append(kp.Replicas, rtr)
}

if skip {
if skip || len(kp.Replicas) == 0 {
p.SkippedKeyspaces = append(p.SkippedKeyspaces, u.Keyspace)
continue
}
Expand Down

0 comments on commit 2bca285

Please sign in to comment.