Skip to content

Commit

Permalink
Randomize primary term
Browse files Browse the repository at this point in the history
  • Loading branch information
dnhatn committed Jun 18, 2018
1 parent 56da910 commit 496a6bd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,13 @@ public void testCacheRemoteShardFailed() throws Exception {
final String index = "test";
setState(clusterService, ClusterStateCreationUtils.stateWithActivePrimary(index, true, randomInt(5)));
ShardRouting failedShard = getRandomShardRouting(index);
long primaryTerm = clusterService.state().metaData().index(index).primaryTerm(failedShard.id());
boolean markAsStale = randomBoolean();
int numListeners = between(1, 100);
CountDownLatch latch = new CountDownLatch(numListeners);
long primaryTerm = randomLongBetween(1, Long.MAX_VALUE);
for (int i = 0; i < numListeners; i++) {
shardStateAction.remoteShardFailed(failedShard.shardId(), failedShard.allocationId().getId(),
primaryTerm + 1, markAsStale, "test", getSimulatedFailure(), new ShardStateAction.Listener() {
primaryTerm, markAsStale, "test", getSimulatedFailure(), new ShardStateAction.Listener() {
@Override
public void onSuccess() {
latch.countDown();
Expand Down

0 comments on commit 496a6bd

Please sign in to comment.