Skip to content

Commit

Permalink
Rename successulOps to successfulOps in TransportSearchTypeAction
Browse files Browse the repository at this point in the history
  • Loading branch information
s1monw committed Apr 7, 2014
1 parent befa833 commit 49c74e0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Expand Up @@ -78,7 +78,7 @@ protected void moveToSecondPhase() throws Exception {
if (request.scroll() != null) {
scrollId = buildScrollId(request.searchType(), firstResults, null);
}
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures()));
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successfulOps.get(), buildTookInMillis(), buildShardFailures()));
}
}
}
Expand Up @@ -158,7 +158,7 @@ void onSecondPhaseFailure(Throwable t, QuerySearchRequest querySearchRequest, in
logger.debug("[{}] Failed to execute query phase", t, querySearchRequest.id());
}
this.addShardFailure(shardIndex, dfsResult.shardTarget(), t);
successulOps.decrementAndGet();
successfulOps.decrementAndGet();
if (counter.decrementAndGet() == 0) {
finishHim();
}
Expand All @@ -185,7 +185,7 @@ void innerFinishHim() throws Exception {
if (request.scroll() != null) {
scrollId = TransportSearchHelper.buildScrollId(request.searchType(), firstResults, null);
}
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures()));
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successfulOps.get(), buildTookInMillis(), buildShardFailures()));
}
}
}
Expand Up @@ -168,7 +168,7 @@ void onQueryFailure(Throwable t, QuerySearchRequest querySearchRequest, int shar
logger.debug("[{}] Failed to execute query phase", t, querySearchRequest.id());
}
this.addShardFailure(shardIndex, dfsResult.shardTarget(), t);
successulOps.decrementAndGet();
successfulOps.decrementAndGet();
if (counter.decrementAndGet() == 0) {
executeFetchPhase();
}
Expand Down Expand Up @@ -272,7 +272,7 @@ void onFetchFailure(Throwable t, FetchSearchRequest fetchSearchRequest, int shar
logger.debug("[{}] Failed to execute fetch phase", t, fetchSearchRequest.id());
}
this.addShardFailure(shardIndex, shardTarget, t);
successulOps.decrementAndGet();
successfulOps.decrementAndGet();
if (counter.decrementAndGet() == 0) {
finishHim();
}
Expand All @@ -298,7 +298,7 @@ void innerFinishHim() throws Exception {
if (request.scroll() != null) {
scrollId = TransportSearchHelper.buildScrollId(request.searchType(), firstResults, null);
}
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures()));
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successfulOps.get(), buildTookInMillis(), buildShardFailures()));
}
}
}
Expand Up @@ -91,7 +91,7 @@ private void innerFinishHim() throws IOException {
if (request.scroll() != null) {
scrollId = buildScrollId(request.searchType(), firstResults, null);
}
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures()));
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successfulOps.get(), buildTookInMillis(), buildShardFailures()));
}
}
}
Expand Up @@ -172,7 +172,7 @@ void onFetchFailure(Throwable t, FetchSearchRequest fetchSearchRequest, int shar
logger.debug("[{}] Failed to execute fetch phase", t, fetchSearchRequest.id());
}
this.addShardFailure(shardIndex, shardTarget, t);
successulOps.decrementAndGet();
successfulOps.decrementAndGet();
if (counter.decrementAndGet() == 0) {
finishHim();
}
Expand All @@ -198,7 +198,7 @@ void innerFinishHim() throws Exception {
if (request.scroll() != null) {
scrollId = TransportSearchHelper.buildScrollId(request.searchType(), firstResults, null);
}
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures()));
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successfulOps.get(), buildTookInMillis(), buildShardFailures()));
}
}
}
Expand Up @@ -75,7 +75,7 @@ protected void moveToSecondPhase() throws Exception {
if (request.scroll() != null) {
scrollId = buildScrollId(request.searchType(), firstResults, ImmutableMap.of("total_hits", Long.toString(internalResponse.hits().totalHits())));
}
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures()));
listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successfulOps.get(), buildTookInMillis(), buildShardFailures()));
}
}
}
Expand Up @@ -89,7 +89,7 @@ protected abstract class BaseAsyncAction<FirstResult extends SearchPhaseResult>
protected final int expectedSuccessfulOps;
private final int expectedTotalOps;

protected final AtomicInteger successulOps = new AtomicInteger();
protected final AtomicInteger successfulOps = new AtomicInteger();
private final AtomicInteger totalOps = new AtomicInteger();

protected final AtomicArray<FirstResult> firstResults;
Expand Down Expand Up @@ -249,7 +249,7 @@ void onFirstPhaseResult(int shardIndex, ShardRouting shard, FirstResult result,
// we need to increment successful ops first before we compare the exit condition otherwise if we
// are fast we could concurrently update totalOps but then preempt one of the threads which can
// cause the successor to read a wrong value from successfulOps if second phase is very fast ie. count etc.
successulOps.incrementAndGet();
successfulOps.incrementAndGet();
// 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
final int xTotalOps = totalOps.addAndGet(shardIt.remaining() + 1);
Expand Down Expand Up @@ -283,7 +283,7 @@ void onFirstPhaseResult(final int shardIndex, @Nullable ShardRouting shard, @Nul
logger.trace("{}: Failed to execute [{}]", t, shard, request);
}
}
if (successulOps.get() == 0) {
if (successfulOps.get() == 0) {
if (logger.isDebugEnabled()) {
logger.debug("All shards failed for phase: [{}]", firstPhaseName(), t);
}
Expand Down

0 comments on commit 49c74e0

Please sign in to comment.