Fix ThreadPoolMergeExecutorServiceDiskSpaceTests testAbortingOrRunningMergeTaskHoldsUpBudget (#129979)

When there are multiple FS with the same available disk space but different total sizes, it's unpredictable (and irrelevant) which one the checker uses.

Fixes #129823
This commit is contained in:
Albert Zaharovits 2025-06-25 12:06:10 +03:00 committed by GitHub
parent f095b3c592
commit 98a6354ad4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -551,9 +551,6 @@ tests:
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT
method: test
issue: https://github.com/elastic/elasticsearch/issues/129819
- class: org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceDiskSpaceTests
method: testAbortingOrRunningMergeTaskHoldsUpBudget
issue: https://github.com/elastic/elasticsearch/issues/129823
- class: org.elasticsearch.index.store.FsDirectoryFactoryTests
method: testPreload
issue: https://github.com/elastic/elasticsearch/issues/129852

View File

@ -534,7 +534,7 @@ public class ThreadPoolMergeExecutorServiceDiskSpaceTests extends ESTestCase {
aFileStore.totalSpace = randomLongBetween(1_000L, 10_000L);
bFileStore.totalSpace = randomLongBetween(1_000L, 10_000L);
aFileStore.usableSpace = randomLongBetween(900L, aFileStore.totalSpace);
bFileStore.usableSpace = randomLongBetween(900L, bFileStore.totalSpace);
bFileStore.usableSpace = randomValueOtherThan(aFileStore.usableSpace, () -> randomLongBetween(900L, bFileStore.totalSpace));
boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace;
try (
ThreadPoolMergeExecutorService threadPoolMergeExecutorService = ThreadPoolMergeExecutorService
@ -613,7 +613,7 @@ public class ThreadPoolMergeExecutorServiceDiskSpaceTests extends ESTestCase {
aFileStore.totalSpace = randomLongBetween(1_000L, 10_000L);
bFileStore.totalSpace = randomLongBetween(1_000L, 10_000L);
aFileStore.usableSpace = randomLongBetween(900L, aFileStore.totalSpace);
bFileStore.usableSpace = randomLongBetween(900L, bFileStore.totalSpace);
bFileStore.usableSpace = randomValueOtherThan(aFileStore.usableSpace, () -> randomLongBetween(900L, bFileStore.totalSpace));
boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace;
try (
ThreadPoolMergeExecutorService threadPoolMergeExecutorService = ThreadPoolMergeExecutorService
@ -900,7 +900,7 @@ public class ThreadPoolMergeExecutorServiceDiskSpaceTests extends ESTestCase {
long diskSpaceLimitBytes = randomLongBetween(10L, 100L);
aFileStore.usableSpace = diskSpaceLimitBytes + randomLongBetween(1L, 100L);
aFileStore.totalSpace = aFileStore.usableSpace + randomLongBetween(1L, 10L);
bFileStore.usableSpace = diskSpaceLimitBytes + randomLongBetween(1L, 100L);
bFileStore.usableSpace = randomValueOtherThan(aFileStore.usableSpace, () -> diskSpaceLimitBytes + randomLongBetween(1L, 100L));
bFileStore.totalSpace = bFileStore.usableSpace + randomLongBetween(1L, 10L);
boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace;
Settings.Builder settingsBuilder = Settings.builder().put(settings);
@ -1001,7 +1001,10 @@ public class ThreadPoolMergeExecutorServiceDiskSpaceTests extends ESTestCase {
bFileStore.totalSpace = randomLongBetween(300L, 1_000L);
long grantedUsableSpaceBuffer = randomLongBetween(10L, 50L);
aFileStore.usableSpace = randomLongBetween(200L, aFileStore.totalSpace - grantedUsableSpaceBuffer);
bFileStore.usableSpace = randomLongBetween(200L, bFileStore.totalSpace - grantedUsableSpaceBuffer);
bFileStore.usableSpace = randomValueOtherThan(
aFileStore.usableSpace,
() -> randomLongBetween(200L, bFileStore.totalSpace - grantedUsableSpaceBuffer)
);
boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace;
Settings.Builder settingsBuilder = Settings.builder().put(settings);
// change the watermark level, just for coverage and it's easier with the calculations