Skip to content

Fix Race in AsyncTwoPhaseIndexerTests.testStateMachine (#40947) #41013

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

Merged
merged 1 commit into from
Apr 9, 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 @@ -39,7 +39,7 @@ private class MockIndexer extends AsyncTwoPhaseIndexer<Integer, MockJobStats> {

private final CountDownLatch latch;
// test the execution order
private int step;
private volatile int step;

protected MockIndexer(Executor executor, AtomicReference<IndexerState> initialState, Integer initialPosition,
CountDownLatch latch) {
Expand Down Expand Up @@ -113,8 +113,8 @@ protected void onFailure(Exception exc) {
protected void onFinish(ActionListener<Void> listener) {
assertThat(step, equalTo(4));
++step;
isFinished.set(true);
listener.onResponse(null);
isFinished.set(true);
}

@Override
Expand Down Expand Up @@ -206,8 +206,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
}
}

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