Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Enhance GatewayAllocator to handle a batch of shards fetching #8958

Open
amkhar opened this issue Jul 28, 2023 · 0 comments
Open
Assignees
Labels
Cluster Manager enhancement Enhancement or improvement to existing feature or request

Comments

@amkhar
Copy link
Contributor

amkhar commented Jul 28, 2023

Describe the bug
Original Issue opened : #5098 . This issue is a sub task for the overall project defined #8098.

Description
As part of node drop and joins, GatewayAllocator works on assigning single shard in one call and maintains a map where key is shardId and value is a shard level fetcher (shard level fetcher is responsible for fetching the metadata over transport for single shard).

protected static void innerAllocatedUnassigned(
RoutingAllocation allocation,
PrimaryShardAllocator primaryShardAllocator,
ReplicaShardAllocator replicaShardAllocator,
ShardRouting shardRouting,
ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler
) {
assert shardRouting.unassigned();
if (shardRouting.primary()) {
primaryShardAllocator.allocateUnassigned(shardRouting, allocation, unassignedAllocationHandler);
} else {
replicaShardAllocator.allocateUnassigned(shardRouting, allocation, unassignedAllocationHandler);
}
}

private final ConcurrentMap<
ShardId,
AsyncShardFetch<TransportNodesListGatewayStartedShards.NodeGatewayStartedShards>> asyncFetchStarted = ConcurrentCollections
.newConcurrentMap();
private final ConcurrentMap<ShardId, AsyncShardFetch<TransportNodesListShardStoreMetadata.NodeStoreFilesMetadata>> asyncFetchStore =
ConcurrentCollections.newConcurrentMap();

GatewayAllocator now needs to take care of bookkeeping of multiple batches, where single batch can have multiple shards. One key constraint is that one batch will be fixed for a set of shards and we won't add any new shards in a batch after batch is created.

Functionalities required

  • Keep fetchers at batch level also in a separate map
  • Create batches for assigning all unassigned shards
  • Keep necessary data structures so finding the batch for a shard or find shards for a batch is easy
  • Cleanup the newly created maps accordingly when the whole batch assignment is finished

Additional context
Please go through the discussion #5098 to understand the overall enhancement approach and check #8098 to see the sub tasks of overall project.

@amkhar amkhar added bug Something isn't working untriaged labels Jul 28, 2023
@Xtansia Xtansia added distributed framework enhancement Enhancement or improvement to existing feature or request and removed bug Something isn't working labels Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cluster Manager enhancement Enhancement or improvement to existing feature or request
Projects
Status: Now(This Quarter)
Development

No branches or pull requests

3 participants