Skip to content

Commit

Permalink
Fix spotless fix
Browse files Browse the repository at this point in the history
Signed-off-by: Arpit Bandejiya <[email protected]>
  • Loading branch information
Arpit-Bandejiya committed Feb 16, 2024
1 parent fa38d3d commit d1b90aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.opensearch.cluster.routing.allocation.decider.AllocationDeciders;
import org.opensearch.cluster.routing.allocation.decider.Decision;
import org.opensearch.cluster.routing.allocation.decider.DiskThresholdDecider;
import org.opensearch.common.Randomness;
import org.opensearch.common.collect.Tuple;
import org.opensearch.gateway.PriorityComparator;

Expand Down Expand Up @@ -1011,7 +1012,7 @@ AllocateUnassignedDecision decideAllocateUnassigned(final ShardRouting shard) {
if (minNodes.isEmpty()){
minNode = null;
} else {
minNode = minNodes.get(new Random().nextInt(minNodes.size()));
minNode = minNodes.get(Randomness.get().nextInt(minNodes.size()));
}
return AllocateUnassignedDecision.fromDecision(decision, minNode != null ? minNode.getRoutingNode().node() : null, nodeDecisions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private final static String printShardAllocationWithHeader(int[] shardCount) {
private final static String printShardAllocationWithHeader(String[] indexNames) {
StringBuffer sb = new StringBuffer();
Formatter formatter = new Formatter(sb, Locale.getDefault());
for( String index: indexNames) {
for (String index : indexNames) {
formatter.format("%-20s", index);
}
formatter.format("\n");
Expand Down Expand Up @@ -382,10 +382,12 @@ private static void buildMap(ClusterState inputState) {
}
}

private static void updateMap(TreeMap<String, int[]> ShardCountMapToUpdate,
TreeMap<String, String[]> nodeIdToIndexMapToUpdate,
TreeMap<String, String[]> nodeIdToIndexReplicaMapToUpdate,
ShardRouting shardRouting) {
private static void updateMap(
TreeMap<String, int[]> ShardCountMapToUpdate,
TreeMap<String, String[]> nodeIdToIndexMapToUpdate,
TreeMap<String, String[]> nodeIdToIndexReplicaMapToUpdate,
ShardRouting shardRouting
) {
int[] shard;
shard = shardRouting.assignedToNode() ? ShardCountMapToUpdate.get(shardRouting.currentNodeId()) : unassigned;
String indexName = shardRouting.getIndexName();
Expand All @@ -406,7 +408,6 @@ private static void updateMap(TreeMap<String, int[]> ShardCountMapToUpdate,
nodeIdToIndexReplicaMapToUpdate.put(shardRouting.currentNodeId(), newArray);
}


// For assigned shards, put back counter
if (shardRouting.assignedToNode()) ShardCountMapToUpdate.put(shardRouting.currentNodeId(), shard);
}
Expand Down

0 comments on commit d1b90aa

Please sign in to comment.