Skip to content

Commit

Permalink
Fixed PR comments around documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Chandani <chngau@amazon.com>
  • Loading branch information
Gaurav614 committed Feb 12, 2024
1 parent 257f36d commit 1574fc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.opensearch.cluster.routing.allocation.command.AllocationCommands;
import org.opensearch.cluster.routing.allocation.decider.AllocationDeciders;
import org.opensearch.cluster.routing.allocation.decider.Decision;
import org.opensearch.common.collect.ImmutableOpenMap;
import org.opensearch.common.settings.Settings;
import org.opensearch.gateway.GatewayAllocator;
import org.opensearch.gateway.PriorityComparator;
Expand Down Expand Up @@ -200,9 +201,9 @@ private ClusterState buildResult(ClusterState oldState, RoutingAllocation alloca
if (restoreInProgress != null) {
RestoreInProgress updatedRestoreInProgress = allocation.updateRestoreInfoWithRoutingChanges(restoreInProgress);
if (updatedRestoreInProgress != restoreInProgress) {
final Map<String, ClusterState.Custom> customsBuilder = new HashMap<>(allocation.getCustoms());
ImmutableOpenMap.Builder<String, ClusterState.Custom> customsBuilder = ImmutableOpenMap.builder(allocation.getCustoms());
customsBuilder.put(RestoreInProgress.TYPE, updatedRestoreInProgress);
newStateBuilder.customs(customsBuilder);
newStateBuilder.customs(customsBuilder.build());
}
}
return newStateBuilder.build();
Expand Down Expand Up @@ -577,6 +578,7 @@ private void allocateExistingUnassignedShards(RoutingAllocation allocation) {
ExistingShardsAllocator allocator = existingShardsAllocators.get(ShardsBatchGatewayAllocator.ALLOCATOR_NAME);
allocator.allocateAllUnassignedShards(allocation, true);
allocator.afterPrimariesBeforeReplicas(allocation);
// Replicas Assignment
allocator.allocateAllUnassignedShards(allocation, false);
return;
}
Expand Down Expand Up @@ -704,7 +706,7 @@ private ExistingShardsAllocator getAllocatorForShard(ShardRouting shardRouting,
final String allocatorName = ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.get(
routingAllocation.metadata().getIndexSafe(shardRouting.index()).getSettings()
);
ExistingShardsAllocator existingShardsAllocator = existingShardsAllocators.get(allocatorName);
final ExistingShardsAllocator existingShardsAllocator = existingShardsAllocators.get(allocatorName);
return existingShardsAllocator != null ? existingShardsAllocator : new NotFoundAllocator(allocatorName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,10 @@ public interface ExistingShardsAllocator {
* {@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
* Allocation Service will fallback to default implementation i.e. {@link ExistingShardsAllocator#allocateUnassigned(ShardRouting, RoutingAllocation, UnassignedAllocationHandler)}
*
* If no plugin overrides {@link ExistingShardsAllocator} then default implementation will be use for it , i.e,
* {@link ShardsBatchGatewayAllocator}. Right now even if plugin implements it, AllocationService will run the
* default implementation to enable Batch mode of assignment
* {@link ShardsBatchGatewayAllocator}.
*
* TODO: Currently its implementation is WIP for GatewayAllocator so setting enabling wont have any effect
* https://github.com/opensearch-project/OpenSearch/issues/5098
* This setting is experimental at this point.
*/
Setting<Boolean> EXISTING_SHARDS_ALLOCATOR_BATCH_MODE = Setting.boolSetting(
"cluster.allocator.existing_shards_allocator.batch_enabled",
Expand Down

0 comments on commit 1574fc2

Please sign in to comment.