-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix ThreadPoolMergeSchedulerTests testSchedulerCloseWaitsForRunningMerge #130078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
elasticsearchmachine
merged 8 commits into
elastic:main
from
albertzaharovits:fix-125236
Jun 26, 2025
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
47a3055
Fix 129149
albertzaharovits 9fe6538
Merge branch 'main' into fix-129149
albertzaharovits 7e7f840
Merge branch 'main' into fix-129149
albertzaharovits 1539d43
Fixes race in test between merge task scheduling and scheduler close
albertzaharovits a70c16b
Revert "Fix 129149"
albertzaharovits a59b703
Merge branch 'main' into fix-125236
albertzaharovits 6c554e2
Merge branch 'main' into fix-125236
albertzaharovits a21d8c6
Merge branch 'main' into fix-125236
albertzaharovits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,10 +324,19 @@ public void testDiskSpaceMonitorStartsAsDisabled() throws Exception { | |
| } | ||
|
|
||
| public void testAvailableDiskSpaceMonitorWhenFileSystemStatErrors() throws Exception { | ||
| aFileStore.usableSpace = randomLongBetween(1L, 100L); | ||
| aFileStore.totalSpace = randomLongBetween(1L, 100L); | ||
| bFileStore.usableSpace = randomLongBetween(1L, 100L); | ||
| bFileStore.totalSpace = randomLongBetween(1L, 100L); | ||
| long aUsableSpace; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also looks like it belongs somewhere else? Maybe I reviewed this part in another PR already, looks familiar but did not check. Maybe once that is merged, this change disappears? |
||
| long bUsableSpace; | ||
| do { | ||
| aFileStore.usableSpace = randomLongBetween(1L, 1000L); | ||
| aFileStore.totalSpace = randomLongBetween(1L, 1000L); | ||
| bFileStore.usableSpace = randomLongBetween(1L, 1000L); | ||
| bFileStore.totalSpace = randomLongBetween(1L, 1000L); | ||
| // the default 5% (same as flood stage level) | ||
| aUsableSpace = Math.max(aFileStore.usableSpace - aFileStore.totalSpace / 20, 0L); | ||
| bUsableSpace = Math.max(bFileStore.usableSpace - bFileStore.totalSpace / 20, 0L); | ||
| } while (aUsableSpace == bUsableSpace); // they must be different in order to distinguish the available disk space updates | ||
| long finalBUsableSpace = bUsableSpace; | ||
| long finalAUsableSpace = aUsableSpace; | ||
| boolean aErrorsFirst = randomBoolean(); | ||
| if (aErrorsFirst) { | ||
| // the "a" file system will error when collecting stats | ||
|
|
@@ -355,18 +364,10 @@ public void testAvailableDiskSpaceMonitorWhenFileSystemStatErrors() throws Excep | |
| assertThat(availableDiskSpaceUpdates.size(), is(1)); | ||
| if (aErrorsFirst) { | ||
| // uses the stats from "b" | ||
| assertThat( | ||
| availableDiskSpaceUpdates.getLast().getBytes(), | ||
| // the default 5% (same as flood stage level) | ||
| is(Math.max(bFileStore.usableSpace - bFileStore.totalSpace / 20, 0L)) | ||
| ); | ||
| assertThat(availableDiskSpaceUpdates.getLast().getBytes(), is(finalBUsableSpace)); | ||
| } else { | ||
| // uses the stats from "a" | ||
| assertThat( | ||
| availableDiskSpaceUpdates.getLast().getBytes(), | ||
| // the default 5% (same as flood stage level) | ||
| is(Math.max(aFileStore.usableSpace - aFileStore.totalSpace / 20, 0L)) | ||
| ); | ||
| assertThat(availableDiskSpaceUpdates.getLast().getBytes(), is(finalAUsableSpace)); | ||
| } | ||
| } | ||
| }); | ||
|
|
@@ -393,21 +394,14 @@ public void testAvailableDiskSpaceMonitorWhenFileSystemStatErrors() throws Excep | |
| } | ||
| assertBusy(() -> { | ||
| synchronized (availableDiskSpaceUpdates) { | ||
| // the updates are different values | ||
| assertThat(availableDiskSpaceUpdates.size(), is(3)); | ||
| if (aErrorsFirst) { | ||
| // uses the stats from "a" | ||
| assertThat( | ||
| availableDiskSpaceUpdates.getLast().getBytes(), | ||
| // the default 5% (same as flood stage level) | ||
| is(Math.max(aFileStore.usableSpace - aFileStore.totalSpace / 20, 0L)) | ||
| ); | ||
| assertThat(availableDiskSpaceUpdates.getLast().getBytes(), is(finalAUsableSpace)); | ||
| } else { | ||
| // uses the stats from "b" | ||
| assertThat( | ||
| availableDiskSpaceUpdates.getLast().getBytes(), | ||
| // the default 5% (same as flood stage level) | ||
| is(Math.max(bFileStore.usableSpace - bFileStore.totalSpace / 20, 0L)) | ||
| ); | ||
| assertThat(availableDiskSpaceUpdates.getLast().getBytes(), is(finalBUsableSpace)); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks out-of-place for this PR?