Skip to content

Commit

Permalink
[Tests] Do not use all permits acquisition in replica promotion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Nov 23, 2018
1 parent a204d1c commit 5e83bcb
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,6 @@ public void testGlobalCheckpointSync() throws IOException {
closeShards(replicaShard, primaryShard);
}

@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/35850")
public void testRestoreLocalHistoryFromTranslogOnPromotion() throws IOException, InterruptedException {
final IndexShard indexShard = newStartedShard(false);
final int operations = 1024 - scaledRandomIntBetween(0, 1024);
Expand All @@ -1039,7 +1038,7 @@ public void testRestoreLocalHistoryFromTranslogOnPromotion() throws IOException,
final Set<String> docsBeforeRollback = getShardDocUIDs(indexShard);
final CountDownLatch latch = new CountDownLatch(1);
final boolean shouldRollback = Math.max(globalCheckpointOnReplica, globalCheckpoint) < maxSeqNo;
randomReplicaOperationPermitAcquisition(indexShard,
indexShard.acquireReplicaOperationPermit(
indexShard.getPendingPrimaryTerm() + 1,
globalCheckpoint,
maxSeqNoOfUpdatesOrDeletes,
Expand All @@ -1054,7 +1053,8 @@ public void onResponse(Releasable releasable) {
public void onFailure(Exception e) {

}
}, "");
},
ThreadPool.Names.SAME, "");

latch.await();
if (shouldRollback) {
Expand Down Expand Up @@ -1088,7 +1088,6 @@ public void onFailure(Exception e) {
closeShard(indexShard, false);
}

@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/35850")
public void testRollbackReplicaEngineOnPromotion() throws IOException, InterruptedException {
final IndexShard indexShard = newStartedShard(false);

Expand All @@ -1106,7 +1105,7 @@ public void testRollbackReplicaEngineOnPromotion() throws IOException, Interrupt
&& indexShard.seqNoStats().getMaxSeqNo() != SequenceNumbers.NO_OPS_PERFORMED;
final Engine beforeRollbackEngine = indexShard.getEngine();
final long newMaxSeqNoOfUpdates = randomLongBetween(indexShard.getMaxSeqNoOfUpdatesOrDeletes(), Long.MAX_VALUE);
randomReplicaOperationPermitAcquisition(indexShard,
indexShard.acquireReplicaOperationPermit(
indexShard.pendingPrimaryTerm + 1,
globalCheckpoint,
newMaxSeqNoOfUpdates,
Expand All @@ -1121,7 +1120,8 @@ public void onResponse(final Releasable releasable) {
public void onFailure(final Exception e) {

}
}, "");
},
ThreadPool.Names.SAME, "");

latch.await();
if (globalCheckpointOnReplica == SequenceNumbers.UNASSIGNED_SEQ_NO && globalCheckpoint == SequenceNumbers.UNASSIGNED_SEQ_NO) {
Expand Down

0 comments on commit 5e83bcb

Please sign in to comment.