Remove Dead Conditional from RoutingTable (#56870) (#56914)

`delta` is always positive here.

Co-authored-by: Howard <danielhuang@tencent.com>
This commit is contained in:
Armin Braun 2020-05-18 17:18:26 +02:00 committed by GitHub
parent b21330b00c
commit 46e5c37267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -477,15 +477,10 @@ public class RoutingTable implements Iterable<IndexRoutingTable>, Diffable<Routi
builder.addReplica();
}
} else if (currentNumberOfReplicas > numberOfReplicas) {
int delta = currentNumberOfReplicas - numberOfReplicas;
if (delta <= 0) {
// ignore, can't remove below the current one...
} else {
for (int i = 0; i < delta; i++) {
for (int i = 0; i < (currentNumberOfReplicas - numberOfReplicas); i++) {
builder.removeReplica();
}
}
}
indicesRouting.put(index, builder.build());
}
return this;