Skip to content

Commit 0af8050

Browse files
committed
Check for capacity before we check for existing record
1 parent 6d5d2fa commit 0af8050

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/UndesiredAllocationsTracker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class UndesiredAllocationsTracker {
8989
*/
9090
public void trackUndesiredAllocation(ShardRouting shardRouting) {
9191
assert shardRouting.unassigned() == false : "Shouldn't record unassigned shards as undesired allocations";
92-
if (undesiredAllocations.containsKey(shardRouting) == false && undesiredAllocations.size() < maxUndesiredAllocationsToTrack) {
92+
if (undesiredAllocations.size() < maxUndesiredAllocationsToTrack && undesiredAllocations.containsKey(shardRouting) == false) {
9393
undesiredAllocations.put(shardRouting, timeProvider.relativeTimeInMillis());
9494
}
9595
}

0 commit comments

Comments
 (0)