Skip to content

Commit

Permalink
search operation where only some shards would fail might hang
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Feb 20, 2010
1 parent 21a1021 commit fa54b7c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void performFirstPhase(final Iterator<ShardRouting> shardIt) {
Node node = nodes.get(shard.currentNodeId());
sendExecuteFirstPhase(node, internalSearchRequest(shard, request), new SearchServiceListener<FirstResult>() {
@Override public void onResult(FirstResult result) {
onFirstPhaseResult(shard, result);
onFirstPhaseResult(shard, result, shardIt);
}

@Override public void onFailure(Throwable t) {
Expand All @@ -183,8 +183,14 @@ private void performFirstPhase(final Iterator<ShardRouting> shardIt) {
}
}

private void onFirstPhaseResult(ShardRouting shard, FirstResult result) {
private void onFirstPhaseResult(ShardRouting shard, FirstResult result, Iterator<ShardRouting> shardIt) {
processFirstPhaseResult(shard, result);
// increment all the "future" shards to update the total ops since we some may work and some may not...
// and when that happens, we break on total ops, so we must maintain them
while (shardIt.hasNext()) {
totalOps.incrementAndGet();
shardIt.next();
}
if (successulOps.incrementAndGet() == expectedSuccessfulOps ||
totalOps.incrementAndGet() == expectedTotalOps) {
moveToSecondPhase();
Expand Down

0 comments on commit fa54b7c

Please sign in to comment.