Skip to content

Commit

Permalink
Switch to ShardsBatchGatewayAllocator in batch enabled mode for shard…
Browse files Browse the repository at this point in the history
… explain allocation API

Signed-off-by: Swetha Guptha <gupthasg@amazon.com>
  • Loading branch information
Swetha Guptha committed Jun 10, 2024
1 parent b9ca5a8 commit 27a1e00
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,17 @@ private AllocateUnassignedDecision explainUnassignedShardAllocation(ShardRouting

private ExistingShardsAllocator getAllocatorForShard(ShardRouting shardRouting, RoutingAllocation routingAllocation) {
assert assertInitialized();
final String allocatorName = ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.get(
routingAllocation.metadata().getIndexSafe(shardRouting.index()).getSettings()
);
String allocatorName;
Boolean batchModeEnabled = EXISTING_SHARDS_ALLOCATOR_BATCH_MODE.get(settings);
if (batchModeEnabled
&& routingAllocation.nodes().getMinNodeVersion().onOrAfter(Version.V_2_14_0)
&& existingShardsAllocators.size() == 2) {
allocatorName = ShardsBatchGatewayAllocator.ALLOCATOR_NAME;
} else {
allocatorName = ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.get(
routingAllocation.metadata().getIndexSafe(shardRouting.index()).getSettings()
);
}
final ExistingShardsAllocator existingShardsAllocator = existingShardsAllocators.get(allocatorName);
return existingShardsAllocator != null ? existingShardsAllocator : new NotFoundAllocator(allocatorName);
}
Expand Down

0 comments on commit 27a1e00

Please sign in to comment.