@@ -219,18 +219,16 @@ public void testTargetIORateChangesWhenSubmittingMergeTasks() throws Exception {
219219 }
220220 long newIORate = threadPoolMergeExecutorService .getTargetIORateBytesPerSec ();
221221 if (supportsIOThrottling ) {
222- if (submittedIOThrottledMergeTasks .get () < threadPoolMergeExecutorService
223- .getConcurrentMergesFloorLimitForThrottling ()) {
224- // assert the IO rate decreases, with a floor limit, when there are few merge tasks enqueued
222+ if (submittedIOThrottledMergeTasks .get () < 2 ) {
223+ // assert the IO rate decreases, with a floor limit, when there is just a single merge task running
225224 assertThat (newIORate , either (is (MIN_IO_RATE .getBytes ())).or (lessThan (currentIORate )));
226- } else if (submittedIOThrottledMergeTasks .get () > threadPoolMergeExecutorService
227- .getConcurrentMergesCeilLimitForThrottling ()) {
228- // assert the IO rate increases, with a ceiling limit, when there are many merge tasks enqueued
229- assertThat (newIORate , either (is (MAX_IO_RATE .getBytes ())).or (greaterThan (currentIORate )));
230- } else {
231- // assert the IO rate does NOT change when there are a couple of merge tasks enqueued
232- assertThat (newIORate , equalTo (currentIORate ));
233- }
225+ } else if (submittedIOThrottledMergeTasks .get () > threadPoolMergeExecutorService .getMaxConcurrentMerges () * 2 ) {
226+ // assert the IO rate increases, with a ceiling limit, when there are many merge tasks enqueued
227+ assertThat (newIORate , either (is (MAX_IO_RATE .getBytes ())).or (greaterThan (currentIORate )));
228+ } else {
229+ // assert the IO rate does NOT change when there are a couple of merge tasks enqueued
230+ assertThat (newIORate , equalTo (currentIORate ));
231+ }
234232 } else {
235233 // assert the IO rate does not change, when the merge task doesn't support IO throttling
236234 assertThat (newIORate , equalTo (currentIORate ));
@@ -375,17 +373,16 @@ private void testIORateAdjustedForSubmittedTasks(
375373 initialTasksCounter --;
376374 threadPoolMergeExecutorService .submitMergeTask (mergeTask );
377375 long newTargetIORateLimit = threadPoolMergeExecutorService .getTargetIORateBytesPerSec ();
378- if (currentlySubmittedMergeTaskCount .get () < threadPoolMergeExecutorService . getConcurrentMergesFloorLimitForThrottling () ) {
376+ if (currentlySubmittedMergeTaskCount .get () < 2 ) {
379377 // assert the IO rate decreases, with a floor limit, when there are few merge tasks enqueued
380378 assertThat (newTargetIORateLimit , either (is (MIN_IO_RATE .getBytes ())).or (lessThan (targetIORateLimit .get ())));
381- } else if (currentlySubmittedMergeTaskCount .get () > threadPoolMergeExecutorService
382- .getConcurrentMergesCeilLimitForThrottling ()) {
383- // assert the IO rate increases, with a ceiling limit, when there are many merge tasks enqueued
384- assertThat (newTargetIORateLimit , either (is (MAX_IO_RATE .getBytes ())).or (greaterThan (targetIORateLimit .get ())));
385- } else {
386- // assert the IO rate does change, when there are a couple of merge tasks enqueued
387- assertThat (newTargetIORateLimit , equalTo (targetIORateLimit .get ()));
388- }
379+ } else if (currentlySubmittedMergeTaskCount .get () > threadPoolMergeExecutorService .getMaxConcurrentMerges () * 2 ) {
380+ // assert the IO rate increases, with a ceiling limit, when there are many merge tasks enqueued
381+ assertThat (newTargetIORateLimit , either (is (MAX_IO_RATE .getBytes ())).or (greaterThan (targetIORateLimit .get ())));
382+ } else {
383+ // assert the IO rate does not change, when there are a couple of merge tasks enqueued
384+ assertThat (newTargetIORateLimit , equalTo (targetIORateLimit .get ()));
385+ }
389386 targetIORateLimit .set (newTargetIORateLimit );
390387 } else {
391388 // execute already submitted merge task
0 commit comments