HDDS-14888. Improve DiskCheckUtil.checkReadWrite to tolerate disk full#9972
Open
ChenSammi wants to merge 1 commit intoapache:masterfrom
Open
HDDS-14888. Improve DiskCheckUtil.checkReadWrite to tolerate disk full#9972ChenSammi wants to merge 1 commit intoapache:masterfrom
ChenSammi wants to merge 1 commit intoapache:masterfrom
Conversation
sumitagrawl
reviewed
Mar 27, 2026
Contributor
sumitagrawl
left a comment
There was a problem hiding this comment.
@ChenSammi Thanks for working over this, please check message with OS dependent case
| * where the disk is mounted. | ||
| */ | ||
| public final class DiskCheckUtil { | ||
| public static final String LINUX_DISK_FULL_MESSAGE = "No space left on device"; |
Contributor
There was a problem hiding this comment.
message used to check the failure is OS dependent. We need check if message is same in all supported OS variant or not, docker, mac
| " interrupted."); | ||
| } | ||
|
|
||
| // As WRITE keeps happening there is probability, disk has become full during above check. |
Contributor
There was a problem hiding this comment.
Below is just safe guard check, may be we can keep. We are depending on exception message which may differ in different OS.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
DiskCheckUtil.checkReadWrite does file write and read check to make sure disk is writable and readable.
If disk is full, it will catch the exception and return false.
The outer StorageVolume#check will decide whether mark this time volume check as fail or not, depending on whether volume has more than 100B *2 free space.
As the disk space will dynamically change, so there is change that checkReadWrite() is failed due to disk full, while when below logic is evaluated, it has enough available space again.
if (!diskChecksPassed && getCurrentUsage().getAvailable() < minimumDiskSpace) {The goal of this target is to analysis the exception in checkReadWrite() directly, so that disk full case will not return false.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14888
How was this patch tested?
new unit test
The exception when test with local disk full volume is, FileSystemException for both FileChannel open and output stream write.