-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Cross Cluster Search: propagate original indices per cluster #24328
Cross Cluster Search: propagate original indices per cluster #24328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i left some minors looks good man!
throws IOException { | ||
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex()); | ||
IndexShard indexShard = indexService.getShard(request.shardId().getId()); | ||
SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().getId(), indexShard.shardId()); | ||
SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().getId(), indexShard.shardId(), originalIndices); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this here at all lets pass always null here to the SearchShardTarget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for bringing this up, I was not too sure about this.
@@ -30,14 +30,14 @@ | |||
* ShardsIterators are always returned in ascending order independently of their order at construction | |||
* time. The incoming iterators are sorted to ensure consistent iteration behavior across Nodes / JVMs. | |||
*/ | |||
public final class GroupShardsIterator implements Iterable<ShardIterator> { | |||
public final class GroupShardsIterator<S extends ShardIterator> implements Iterable<S> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/S/ShardIt
@@ -112,7 +112,7 @@ private void innerRun() throws IOException { | |||
final IntArrayList[] docIdsToLoad = searchPhaseController.fillDocIdsToLoad(numShards, reducedQueryPhase.scoreDocs); | |||
if (reducedQueryPhase.scoreDocs.length == 0) { // no docs to fetch -- sidestep everything and return | |||
phaseResults.stream() | |||
.map(e -> e.queryResult()) | |||
.map(SearchPhaseResult::queryResult) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
shards.add(shardIterator); | ||
} | ||
for (ShardIterator shardIterator : localShardsIterator) { | ||
shards.add(shardIterator); | ||
List<ShardRouting> shardRoutings = new ArrayList<>(); | ||
for (ShardRouting shardRouting : shardIterator.asUnordered()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate this copying here :) can we maybe do this:
- make
ShardsIterator extends Iterable<ShardRouting>
- remove
ShardsIterator#asUnordered()
- add
List<ShardRouting> ShardsIterator#getShardRoutings()
that way we can just reuse the list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loving this plan. I don't like this copying either.
@s1monw I addressed your comments and added some tests. Can you have another look please? |
…the original indices
…the original indices
… add getShardRoutings to it.
… add getShardRoutings to it.
3f690a3
to
48e6430
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left one suggestion LGTM otherwise. no need for another review. Thanks for the additional tests
@@ -74,7 +75,12 @@ public int sizeActive() { | |||
} | |||
|
|||
@Override | |||
public Iterable<ShardRouting> asUnordered() { | |||
public List<ShardRouting> getShardRoutings() { | |||
return shards; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe wrap it in an unmodifiable list in the ctor? I think we should not allow mutation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ will do
In case of a Cross Cluster Search, the coordinating node should split the original indices per cluster, and send over to each cluster only its own set of original indices, rather than the set taken from the original search request which contains all the indices. In fact, each remote cluster should not be aware of the indices belonging to other remote clusters.
In case of a Cross Cluster Search, the coordinating node should split the original indices per cluster, and send over to each cluster only its own set of original indices, rather than the set taken from the original search request which contains all the indices. In fact, each remote cluster should not be aware of the indices belonging to other remote clusters.
In case of a Cross Cluster Search, the coordinating node should split the original indices per cluster, and send over to each cluster only its own set of original indices, rather than set taken from the original search request which contains all the indices.
In fact, each remote cluster should not be aware of the indices belonging to other remote clusters.