Skip to content

Commit

Permalink
Renamed allocateUnassignedBatch to allocateAllUnassignedShards
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Chandani <[email protected]>
  • Loading branch information
Gaurav614 committed Jan 12, 2024
1 parent 93c4b50 commit 745662a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ private void allocateExistingUnassignedShards(RoutingAllocation allocation) {
if (batchModeEnabled && allocation.nodes().getMinNodeVersion().onOrAfter(Version.CURRENT) && existingShardsAllocators.size() == 2) {
// if we do not have any custom allocator set then we will be using ShardsBatchGatewayAllocator
ExistingShardsAllocator allocator = existingShardsAllocators.get(ShardsBatchGatewayAllocator.ALLOCATOR_NAME);
allocator.allocateUnassignedBatch(allocation, true);
allocator.allocateAllUnassignedShards(allocation, true);
allocator.afterPrimariesBeforeReplicas(allocation);
allocator.allocateUnassignedBatch(allocation, false);
allocator.allocateAllUnassignedShards(allocation, false);
return;
}
logger.warn("Falling back to single shard assignment since batch mode disable or multiple custom allocators set");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public interface ExistingShardsAllocator {
* in one or more go.
*
* Enable this setting if your ExistingShardAllocator is implementing the
* {@link ExistingShardsAllocator#allocateUnassignedBatch(RoutingAllocation, boolean)} method.
* {@link ExistingShardsAllocator#allocateAllUnassignedShards(RoutingAllocation, boolean)} method.
* The default implementation of this method is not optimized and assigns shards one by one.
*
* If enable to true then it expects all indices of the shard to use same {@link ExistingShardsAllocator}, otherwise
Expand Down Expand Up @@ -110,7 +110,7 @@ void allocateUnassigned(
* Default implementation calls {@link #allocateUnassigned(ShardRouting, RoutingAllocation, UnassignedAllocationHandler)} for each Unassigned shard
* and is kept here for backward compatibility.
*/
default void allocateUnassignedBatch(RoutingAllocation allocation, boolean primary) {
default void allocateAllUnassignedShards(RoutingAllocation allocation, boolean primary) {
RoutingNodes.UnassignedShards.UnassignedIterator iterator = allocation.routingNodes().unassigned().iterator();
while (iterator.hasNext()) {
ShardRouting shardRouting = iterator.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void allocateUnassigned(
}

@Override
public void allocateUnassignedBatch(final RoutingAllocation allocation, boolean primary) {
public void allocateAllUnassignedShards(final RoutingAllocation allocation, boolean primary) {

assert primaryBatchShardAllocator != null;
assert replicaBatchShardAllocator != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected boolean hasInitiatedFetching(ShardRouting shard) {
};

@Override
public void allocateUnassignedBatch(RoutingAllocation allocation, boolean primary) {
public void allocateAllUnassignedShards(RoutingAllocation allocation, boolean primary) {
currentNodes = allocation.nodes();
innerAllocateUnassignedBatch(allocation, primaryBatchShardAllocator, replicaBatchShardAllocator, primary);
}
Expand Down

0 comments on commit 745662a

Please sign in to comment.