diff --git a/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/LocalShardsBalancer.java b/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/LocalShardsBalancer.java index 2296e6353d16e..6f3098ee683b6 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/LocalShardsBalancer.java +++ b/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/LocalShardsBalancer.java @@ -996,9 +996,7 @@ private boolean tryRelocateShard(BalancedShardsAllocator.ModelNode minNode, Bala } // This is a safety net which prevents un-necessary primary shard relocations from maxNode to minNode when // doing such relocation wouldn't help in primary balance. - if (preferPrimaryBalance == true - && shard.primary() - && maxNode.numPrimaryShards() - minNode.numPrimaryShards() < 2) { + if (preferPrimaryBalance == true && shard.primary() && maxNode.numPrimaryShards() - minNode.numPrimaryShards() < 2) { continue; }