ArafatKhan2198 opened a new pull request, #6508: URL: https://github.com/apache/ozone/pull/6508
## What changes were proposed in this pull request? The root cause seems to be an error during the refresh operation of the `CachingSpaceUsageSource`. Specifically, the underlying `SpaceUsageSource` (likely an instance of DU, which uses the Unix du command to calculate disk usage) is failing due to a permission issue when trying to read the /data3/lost+found directory. This failure might cause the `getUsedSpace()` method to return an incorrect value (possibly zero), which, when decremented, results in a negative value. Here are the steps that are likely leading to the issue: This PR introduces error handling and validation in the `CachingSpaceUsageSource` class to ensure data integrity. Specifically, it prevents negative values for used space by validating new values before updating the cache and handles exceptions, including `UncheckedIOException`, by maintaining the last known good value and logging errors. These changes ensure that temporary issues, such as permission errors, do not result in invalid state transitions or data corruption. We catch `UncheckedIOException` because it indicates a problem occurred when the program tried to read or write data, and we saw it during operations like calculating disk space usage. This specific exception wraps lower-level errors, making it a clear sign that something went wrong with I/O operations, which are crucial for accurately tracking disk space. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-10614 ## How was this patch tested? CI ran green :- https://github.com/ArafatKhan2198/ozone/actions/runs/8627744703 Will be adding Unit tests for it if the approach is correct -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
