Skip to content
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

[Test] fix concurrency bug in AsyncTwoPhaseIndexerTests #42275

Merged
merged 1 commit into from
May 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected String getJobId() {

@Override
protected IterationResult<Integer> doProcess(SearchResponse searchResponse) {
awaitForLatch();
assertFalse("should not be called as stoppedBeforeFinished is false", stoppedBeforeFinished);
assertThat(step, equalTo(3));
++step;
return new IterationResult<>(Collections.emptyList(), 3, true);
Expand Down Expand Up @@ -99,6 +99,9 @@ protected void doNextSearch(SearchRequest request, ActionListener<SearchResponse
final SearchResponseSections sections = new SearchResponseSections(
new SearchHits(new SearchHit[0], new TotalHits(0, TotalHits.Relation.EQUAL_TO), 0), null,
null, false, null, null, 1);

// block till latch has been counted down, simulating network latency
awaitForLatch();
nextPhase.onResponse(new SearchResponse(sections, null, 1, 1, 0, 0, ShardSearchFailure.EMPTY_ARRAY, null));
}

Expand Down Expand Up @@ -222,7 +225,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
}
}

@AwaitsFix( bugUrl = "https://github.com/elastic/elasticsearch/issues/42084")
public void testStateMachine() throws Exception {
AtomicReference<IndexerState> state = new AtomicReference<>(IndexerState.STOPPED);
final ExecutorService executor = Executors.newFixedThreadPool(1);
Expand Down Expand Up @@ -265,7 +267,6 @@ public void testStateMachineBrokenSearch() throws InterruptedException {
}
}

@AwaitsFix( bugUrl = "https://github.com/elastic/elasticsearch/issues/42084")
public void testStop_AfterIndexerIsFinished() throws InterruptedException {
AtomicReference<IndexerState> state = new AtomicReference<>(IndexerState.STOPPED);
final ExecutorService executor = Executors.newFixedThreadPool(1);
Expand All @@ -285,7 +286,6 @@ public void testStop_AfterIndexerIsFinished() throws InterruptedException {
}
}

@AwaitsFix( bugUrl = "https://github.com/elastic/elasticsearch/issues/42084")
public void testStop_WhileIndexing() throws InterruptedException {
AtomicReference<IndexerState> state = new AtomicReference<>(IndexerState.STOPPED);
final ExecutorService executor = Executors.newFixedThreadPool(1);
Expand Down