Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,6 @@ tests:
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
method: test {p0=esql/120_profile/avg 8.14 or after}
issue: https://github.com/elastic/elasticsearch/issues/127879
- class: org.elasticsearch.indices.stats.IndexStatsIT
method: testThrottleStats
issue: https://github.com/elastic/elasticsearch/issues/126359
- class: org.elasticsearch.search.vectors.IVFKnnFloatVectorQueryTests
method: testRandomWithFilter
issue: https://github.com/elastic/elasticsearch/issues/127963
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ public Condition newCondition() {
}

public void throttle() {
assert semaphore.availablePermits() == Integer.MAX_VALUE;
semaphore.acquireUninterruptibly(Integer.MAX_VALUE - allowThreads);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.Executors;
import java.util.concurrent.Phaser;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -7686,6 +7687,23 @@ public void testDisableRecoverySource() throws Exception {
}
}

public void testPauseLockCanBeThrottledConcurrently() throws Exception {
int allowThreads = randomIntBetween(2, 8);
var pauseLock = new Engine.PauseLock(allowThreads);
var executor = Executors.newFixedThreadPool(allowThreads);
var barrier = new CyclicBarrier(allowThreads);
for (int i = 0; i < allowThreads; i++) {
executor.submit(() -> {
safeAwait(barrier);
pauseLock.throttle();
pauseLock.unthrottle();
});
}

executor.shutdown();
assertTrue(executor.awaitTermination(10, TimeUnit.SECONDS));
}

private static void assertCommitGenerations(Map<IndexCommit, Engine.IndexCommitRef> commits, List<Long> expectedGenerations) {
assertCommitGenerations(commits.values().stream().map(Engine.IndexCommitRef::getIndexCommit).toList(), expectedGenerations);
}
Expand Down