Skip to content

Commit

Permalink
Remove Dead Conditional from RoutingTable (elastic#56870)
Browse files Browse the repository at this point in the history
`delta` is always positive here.
  • Loading branch information
howardhuanghua authored and original-brownbear committed May 18, 2020
1 parent f296c08 commit e2d5682
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,8 @@ public Builder updateNumberOfReplicas(final int numberOfReplicas, final String[]
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++) {
builder.removeReplica();
}
for (int i = 0; i < (currentNumberOfReplicas - numberOfReplicas); i++) {
builder.removeReplica();
}
}
indicesRouting.put(index, builder.build());
Expand Down

0 comments on commit e2d5682

Please sign in to comment.