Skip to content

Commit

Permalink
Changing variable names
Browse files Browse the repository at this point in the history
Signed-off-by: Nishchay Malhotra <nishcha@amazon.com>
  • Loading branch information
nishchay21 committed Jan 3, 2023
1 parent 31d4061 commit dd4e775
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ public ClusterAwarenessAttributesHealth(
) {
awarenessAttributeName = awarenessAttributeValue;

// This is the Map which is storing the per attribute value health stats.
// The key would be the attribute value like rack-1 and the stats would be stored as value.
Map<String, List<String>> attributesHealth = new HashMap<>();
// This is the Map which is storing the per attribute node list.
Map<String, List<String>> attributesNodeList = new HashMap<>();

// Getting the node map for cluster
ImmutableOpenMap<String, DiscoveryNode> nodeMap = clusterState.nodes().getDataNodes();
Expand All @@ -77,27 +76,27 @@ public ClusterAwarenessAttributesHealth(
if (nodeAttributes.containsKey(awarenessAttributeName)) {
attributeValue = nodeAttributes.get(awarenessAttributeName);

if (!attributesHealth.containsKey(attributeValue)) {
if (!attributesNodeList.containsKey(attributeValue)) {
clusterAwarenessAttributeNodeList = new ArrayList<>();
attributesHealth.put(attributeValue, clusterAwarenessAttributeNodeList);
attributesNodeList.put(attributeValue, clusterAwarenessAttributeNodeList);
} else {
clusterAwarenessAttributeNodeList = attributesHealth.get(attributeValue);
clusterAwarenessAttributeNodeList = attributesNodeList.get(attributeValue);
}
clusterAwarenessAttributeNodeList.add(node);
}
}
}
}

setClusterAwarenessAttributeValue(attributesHealth, displayUnassignedShardLevelInfo, clusterState);
setClusterAwarenessAttributeValue(attributesNodeList, displayUnassignedShardLevelInfo, clusterState);
}

private void setClusterAwarenessAttributeValue(
Map<String, List<String>> perAttributeValueHealthMap,
Map<String, List<String>> perAttributeValueNodeList,
boolean displayUnassignedShardLevelInfo,
ClusterState clusterState
) {
int numAttributes = perAttributeValueHealthMap.size();
int numAttributes = perAttributeValueNodeList.size();
int shardsPerAttributeValue = 0;

// Can happen customer has defined weights as well as awareness attribute but no node level attribute was there
Expand All @@ -108,10 +107,10 @@ private void setClusterAwarenessAttributeValue(

Map<String, ClusterAwarenessAttributeValueHealth> clusterAwarenessAttributeValueHealthMap = new HashMap<>();

for (String attributeValueKey : perAttributeValueHealthMap.keySet()) {
for (String attributeValueKey : perAttributeValueNodeList.keySet()) {
ClusterAwarenessAttributeValueHealth clusterAwarenessAttributeValueHealth = new ClusterAwarenessAttributeValueHealth(
attributeValueKey,
perAttributeValueHealthMap.get(attributeValueKey)
perAttributeValueNodeList.get(attributeValueKey)
);
// computing attribute info
clusterAwarenessAttributeValueHealth.computeAttributeValueLevelInfo(
Expand Down

0 comments on commit dd4e775

Please sign in to comment.