Skip to content

Commit

Permalink
Cosmetic changes in AllocationService
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Chandani <chngau@amazon.com>
  • Loading branch information
Gaurav614 committed Dec 20, 2023
1 parent 6e645a0 commit b1994fa
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ private void allocateExistingUnassignedShards(RoutingAllocation allocation) {
if (batchModeEnabled && allocation.nodes().getMinNodeVersion().onOrAfter(Version.CURRENT)) {
// since allocators is per index setting, to have batch assignment verify allocators same for all shards
// if not fallback to single assignment
ExistingShardsAllocator allocator = verifySameAllocatorForAllUnassignedShards(allocation);
ExistingShardsAllocator allocator = getAndVerifySameAllocatorForAllUnassignedShards(allocation);
if (allocator != null) {
// use batch mode implementation of GatewayAllocator
if (allocator.getClass() == GatewayAllocator.class) {
Expand Down Expand Up @@ -618,7 +618,7 @@ private void allocateExistingUnassignedShards(RoutingAllocation allocation) {
* @param allocation {@link RoutingAllocation}
* @return {@link ExistingShardsAllocator} or null
*/
private ExistingShardsAllocator verifySameAllocatorForAllUnassignedShards(RoutingAllocation allocation) {
private ExistingShardsAllocator getAndVerifySameAllocatorForAllUnassignedShards(RoutingAllocation allocation) {
// if there is a single Allocator set in Allocation Service then use it for all shards
if (existingShardsAllocators.size() == 1) {
return existingShardsAllocators.values().iterator().next();
Expand All @@ -627,8 +627,7 @@ private ExistingShardsAllocator verifySameAllocatorForAllUnassignedShards(Routin
RoutingNodes.UnassignedShards.UnassignedIterator iterator = unassignedShards.iterator();
ExistingShardsAllocator currentAllocatorForShard = null;
if (unassignedShards.size() > 0) {
ShardRouting shard = iterator.next();
currentAllocatorForShard = getAllocatorForShard(shard, allocation);
currentAllocatorForShard = getAllocatorForShard(iterator.next(), allocation);
while (iterator.hasNext()) {
ExistingShardsAllocator allocatorForShard = getAllocatorForShard(iterator.next(), allocation);
if (currentAllocatorForShard.getClass().getName().equals(allocatorForShard.getClass().getName()) == false) {
Expand Down

0 comments on commit b1994fa

Please sign in to comment.