File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
server/src/main/java/org/opensearch/cluster/routing/allocation/allocator Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -781,12 +781,14 @@ void allocateUnassigned() {
781781 */
782782 ShardRouting [] unassignedShards = unassigned .drain ();
783783 List <ShardRouting > allUnassignedShards = Arrays .stream (unassignedShards ).collect (Collectors .toList ());
784- List <ShardRouting > localUnassignedShards = allUnassignedShards .stream ()
785- .filter (shard -> RoutingPool .LOCAL_ONLY .equals (RoutingPool .getShardPool (shard , allocation )))
784+ List <ShardRouting > nonLocalUnassignedShards = allUnassignedShards .stream ()
785+ .filter (shard -> ! RoutingPool .LOCAL_ONLY .equals (RoutingPool .getShardPool (shard , allocation )))
786786 .collect (Collectors .toList ());
787- allUnassignedShards .removeAll (localUnassignedShards );
788- allUnassignedShards .forEach (shard -> routingNodes .unassigned ().add (shard ));
789- unassignedShards = localUnassignedShards .toArray (new ShardRouting [0 ]);
787+
788+ nonLocalUnassignedShards .forEach (shard -> routingNodes .unassigned ().add (shard ));
789+ unassignedShards = allUnassignedShards .stream ()
790+ .filter (shard -> RoutingPool .LOCAL_ONLY .equals (RoutingPool .getShardPool (shard , allocation )))
791+ .toArray (ShardRouting []::new );
790792 ShardRouting [] primary = unassignedShards ;
791793 ShardRouting [] secondary = new ShardRouting [primary .length ];
792794 int secondaryLength = 0 ;
You can’t perform that action at this time.
0 commit comments