HDDS-15650. Fix snapshotUsedNamespace underflow when FSO directory is deleted and purged#10545
Merged
Merged
Conversation
… deleted and purged Change-Id: I36ed18620c9aeecf53def5a8ad10bafa2ee567ad
sadanand48
approved these changes
Jun 19, 2026
sadanand48
left a comment
Contributor
There was a problem hiding this comment.
Thanks @jojochuang for the finding this , LGTM
rnblough
approved these changes
Jun 22, 2026
rnblough
left a comment
Contributor
There was a problem hiding this comment.
This is a good fix. Adding the isDirectory check is the minimal effective change to switch it to the behavior the current design expects. I appreciate the additional sanity checks on the testing side, in particular the assertTrue >=0 test added to TestOMKeyDeleteRequestWithFSO.java in lines 401-403. We should copy this practice for every counting value Ozone has.
Thanks @jojochuang!
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?
HDDS-15650. Fix snapshotUsedNamespace underflow when FSO directory is deleted and purged
Please describe your PR in detail:
• The Problem: FSO directories have no blocks, so directory deletion incorrectly evaluated to isKeyNonEmpty = false . This decremented the active
bucket namespace usedNamespace but did not increment snapshotUsedNamespace , causing a mismatch when the directory was later purged (unconditionally
decrementing snapshotUsedNamespace by 1 and underflowing the count to -1 ).
• The Fix: Updated OMKeyDeleteRequestWithFSO.java to shift the namespace quota to the snapshot namespace on deletion if it is either a non-empty key or a
directory (
isKeyNonEmpty || keyStatus.isDirectory() ).
• Test Utils Alignment: Updated mock deleteDir helper in OMRequestTestUtils.java to align with actual deletion quota tracking.
• Regression Test: Added a test case testSnapshotUsedNamespaceAfterDirectoryDeleteAndPurge in TestOMKeyDeleteRequestWithFSO.java to verify that
directory deletion
followed by a purge does not cause negative snapshotUsedNamespace values.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14435
How was this patch tested?
New unit test