fix race condition in SearchPhaseControllerTests#consumerTestCase
This commit is contained in:
parent
e0286e9bd3
commit
4e4ed6ee48
|
@ -277,13 +277,15 @@ class QueryPhaseResultConsumer extends ArraySearchPhaseResults<SearchPhaseResult
|
|||
}
|
||||
failure.compareAndSet(null, exc);
|
||||
MergeTask task = runningTask.get();
|
||||
runningTask.compareAndSet(task, null);
|
||||
List<MergeTask> toCancel = new ArrayList<>();
|
||||
if (task != null) {
|
||||
runningTask.compareAndSet(task, null);
|
||||
task.cancel();
|
||||
toCancel.add(task);
|
||||
}
|
||||
queue.stream().forEach(MergeTask::cancel);
|
||||
queue.stream().forEach(toCancel::add);
|
||||
queue.clear();
|
||||
mergeResult = null;
|
||||
toCancel.stream().forEach(MergeTask::cancel);
|
||||
}
|
||||
onPartialMergeFailure.accept(exc);
|
||||
}
|
||||
|
|
|
@ -487,8 +487,6 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
}
|
||||
|
||||
SearchPhaseController.ReducedQueryPhase reduce = consumer.reduce();
|
||||
int numCompletedTasks = (int) (fixedExecutor.getCompletedTaskCount() - beforeCompletedTasks);
|
||||
assertEquals(numCompletedTasks, reduce.numReducePhases-1);
|
||||
assertEquals(numTotalReducePhases, reduce.numReducePhases);
|
||||
assertEquals(numTotalReducePhases, reductions.size());
|
||||
assertAggReduction(request);
|
||||
|
|
Loading…
Reference in New Issue