File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
server/src/test/java/org/elasticsearch/index/engine Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 162162import java .util .concurrent .BrokenBarrierException ;
163163import java .util .concurrent .CountDownLatch ;
164164import java .util .concurrent .CyclicBarrier ;
165+ import java .util .concurrent .Executors ;
165166import java .util .concurrent .Phaser ;
166167import java .util .concurrent .Semaphore ;
167168import java .util .concurrent .TimeUnit ;
@@ -7686,6 +7687,23 @@ public void testDisableRecoverySource() throws Exception {
76867687 }
76877688 }
76887689
7690+ public void testPauseLockCanBeThrottledConcurrently () throws Exception {
7691+ int allowThreads = randomIntBetween (2 , 8 );
7692+ var pauseLock = new Engine .PauseLock (allowThreads );
7693+ var executor = Executors .newFixedThreadPool (allowThreads );
7694+ var barrier = new CyclicBarrier (allowThreads );
7695+ for (int i = 0 ; i < allowThreads ; i ++) {
7696+ executor .submit (() -> {
7697+ safeAwait (barrier );
7698+ pauseLock .throttle ();
7699+ pauseLock .unthrottle ();
7700+ });
7701+ }
7702+
7703+ executor .shutdown ();
7704+ assertTrue (executor .awaitTermination (10 , TimeUnit .SECONDS ));
7705+ }
7706+
76897707 private static void assertCommitGenerations (Map <IndexCommit , Engine .IndexCommitRef > commits , List <Long > expectedGenerations ) {
76907708 assertCommitGenerations (commits .values ().stream ().map (Engine .IndexCommitRef ::getIndexCommit ).toList (), expectedGenerations );
76917709 }
You can’t perform that action at this time.
0 commit comments