Skip to content

Commit

Permalink
Refactor code for AwarenessAllocationDecider
Browse files Browse the repository at this point in the history
Signed-off-by: Anshu Agarwal <anshukag@amazon.com>
  • Loading branch information
Anshu Agarwal committed Jun 14, 2022
1 parent 1705af0 commit 3d5bff2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ private Decision underCapacity(ShardRouting shardRouting, RoutingNode node, Rout

int numberOfAttributes = nodesPerAttribute.size();
List<String> fullValues = forcedAwarenessAttributes.get(awarenessAttribute);
Set<String> attributesSet = new HashSet<>();

if (fullValues != null) {
// If forced awareness is enabled, numberOfAttributes = count(distinct((union(discovered_attributes, forced_attributes)))
attributesSet.addAll(forcedAwarenessAttributes.get(awarenessAttribute));
Set<String> attributesSet = new HashSet<>(fullValues);
for (ObjectCursor<String> stringObjectCursor : nodesPerAttribute.keys()) {
attributesSet.add(stringObjectCursor.value);
}
Expand Down

0 comments on commit 3d5bff2

Please sign in to comment.