HDDS-14183. Attempted to decrement available space to a negative value#9655
Open
sarvekshayr wants to merge 4 commits intoapache:masterfrom
Open
HDDS-14183. Attempted to decrement available space to a negative value#9655sarvekshayr wants to merge 4 commits intoapache:masterfrom
sarvekshayr wants to merge 4 commits intoapache:masterfrom
Conversation
yandrey321
reviewed
Jan 21, 2026
...tainer-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java
Outdated
Show resolved
Hide resolved
...tainer-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java
Outdated
Show resolved
Hide resolved
...tainer-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java
Show resolved
Hide resolved
yandrey321
reviewed
Jan 23, 2026
| /** | ||
| * Commit space reserved for write to usedSpace when write operation succeeds. | ||
| */ | ||
| private void commitSpaceReservedForWrite(HddsVolume volume, boolean spaceReserved, long bytes) { |
There was a problem hiding this comment.
can commit happen when space is not reserved?
Contributor
Author
There was a problem hiding this comment.
Updated the logic to make the flow clearer by moving the spaceReserved check to the call site. This makes it explicit that the commit operation is invoked only when space has actually been reserved.
yandrey321
reviewed
Jan 23, 2026
...tainer-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java
Outdated
Show resolved
Hide resolved
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?
Saw this warning when datanode disk was nearly full:
Prior to this message, there were many failed writes. Perhaps it needs to increment the value when the write fails.
The fix adds rollback logic in
KeyValueHandler.handleWriteChunk()that tracks when a chunk write succeeds and increments theusedSpacecounter. If any subsequent operation fails, the exception handler callsvolume.decrementUsedSpace()to restore the counter.What is the link to the Apache JIRA
HDDS-14183
How was this patch tested?
CI: https://github.com/sarvekshayr/ozone/actions/runs/21200210393