Skip to content

Commit

Permalink
Removing List.removeAll from LocalShardsBalancer to filter remote sea…
Browse files Browse the repository at this point in the history
…rch shard from relocation decision

Signed-off-by: RS146BIJAY <[email protected]>
  • Loading branch information
RS146BIJAY committed Jul 2, 2024
1 parent 6267e94 commit 836c790
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,12 @@ void allocateUnassigned() {
*/
ShardRouting[] unassignedShards = unassigned.drain();
List<ShardRouting> allUnassignedShards = Arrays.stream(unassignedShards).collect(Collectors.toList());
List<ShardRouting> localUnassignedShards = allUnassignedShards.stream()
.filter(shard -> RoutingPool.LOCAL_ONLY.equals(RoutingPool.getShardPool(shard, allocation)))
List<ShardRouting> nonLocalUnassignedShards = allUnassignedShards.stream()
.filter(shard -> !RoutingPool.LOCAL_ONLY.equals(RoutingPool.getShardPool(shard, allocation)))
.collect(Collectors.toList());
allUnassignedShards.removeAll(localUnassignedShards);
allUnassignedShards.forEach(shard -> routingNodes.unassigned().add(shard));
unassignedShards = localUnassignedShards.toArray(new ShardRouting[0]);
nonLocalUnassignedShards.forEach(shard -> routingNodes.unassigned().add(shard));
unassignedShards = allUnassignedShards.stream()
.filter(shard -> RoutingPool.LOCAL_ONLY.equals(RoutingPool.getShardPool(shard, allocation))).toArray(ShardRouting[]::new);
ShardRouting[] primary = unassignedShards;
ShardRouting[] secondary = new ShardRouting[primary.length];
int secondaryLength = 0;
Expand Down

0 comments on commit 836c790

Please sign in to comment.