Skip to content

Commit

Permalink
Keep initializing shards in batch
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
shiv0408 committed Apr 22, 2024
1 parent 90659b5 commit 27c9b98
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ public int size() {
return shards.size();
}

public Collection<ShardRouting> getInitializingShards() {
return initializingShards;
}

/**
* Add a new shard to this node
* @param shard Shard to create on this Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ else if (shardRouting.primary() == primary) {
}
});

allocation.routingNodes().forEach(
routingNode ->
routingNode.getInitializingShards().forEach(
shardRouting -> {
if (currentBatchedShards.containsKey(shardRouting.shardId()) && shardRouting.primary() == primary) {
batchedShardsToAssign.add(shardRouting.shardId());
}
})
);

refreshShardBatches(currentBatches, batchedShardsToAssign, primary);

Iterator<ShardRouting> iterator = newShardsToBatch.iterator();
Expand Down

0 comments on commit 27c9b98

Please sign in to comment.