Skip to content

Commit 4f35eea

Browse files
committed
[TEST] Fix testConcurrentTermIncreaseOnReplicaShard
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
1 parent 3473217 commit 4f35eea

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ public void testConcurrentTermIncreaseOnReplicaShard() throws BrokenBarrierExcep
10581058
@Override
10591059
public void onResponse(Releasable releasable) {
10601060
counter.incrementAndGet();
1061-
assertThat(indexShard.getPendingPrimaryTerm(), equalTo(primaryTerm + increment));
1061+
assertThat(indexShard.getOperationPrimaryTerm(), equalTo(primaryTerm + increment));
10621062
latch.countDown();
10631063
releasable.close();
10641064
}
@@ -1103,6 +1103,7 @@ public void onFailure(Exception e) {
11031103
}
11041104

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

11071108
closeShards(indexShard);
11081109
}

0 commit comments

Comments
 (0)