Skip to content

Commit

Permalink
[TEST] Fix testConcurrentTermIncreaseOnReplicaShard
Browse files Browse the repository at this point in the history
This test has a bug that got introduced during the refactoring of #32442. With 2 concurrent term increments,
we can only assert under the operation permit that we are in the correct operation term, not that there is
not already another term bump pending.

Closes #34862
  • Loading branch information
ywelsch committed Nov 5, 2018
1 parent 6e8e326 commit 6311231
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ public void testConcurrentTermIncreaseOnReplicaShard() throws BrokenBarrierExcep
@Override
public void onResponse(Releasable releasable) {
counter.incrementAndGet();
assertThat(indexShard.getPendingPrimaryTerm(), equalTo(primaryTerm + increment));
assertThat(indexShard.getOperationPrimaryTerm(), equalTo(primaryTerm + increment));
latch.countDown();
releasable.close();
}
Expand Down Expand Up @@ -1103,6 +1103,7 @@ public void onFailure(Exception e) {
}

assertThat(indexShard.getPendingPrimaryTerm(), equalTo(primaryTerm + Math.max(firstIncrement, secondIncrement)));
assertThat(indexShard.getOperationPrimaryTerm(), equalTo(indexShard.getPendingPrimaryTerm()));

closeShards(indexShard);
}
Expand Down

0 comments on commit 6311231

Please sign in to comment.