HDDS-13479. Support Tracking of Deleted Files and Directories in Recon NSSummary. #8836
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?
When a directory and its files are deleted, fetchSizeForDeletedDirectory returns incorrect size calculations because it relies solely on NamespaceSummary data, which doesn't account for files that still exist in deletedTable.
Steps to Reproduce:
Expected: Returns actual disk space consumed by f1.txt in deletedTable
Actual: Returns 0 because NamespaceSummary.sizeOfFiles was subtracted
Root Cause: NamespaceSummary tracks deleted files by subtracting their size, but deletedTable still contains the actual data blocks. fetchSizeForDeletedDirectory only considers NamespaceSummary data, leading to incorrect size calculations.
Impact: Incorrect space reclamation reports and misleading storage analytics.
This pull request updates the Recon NamespaceSummary logic to correctly account for deleted files and directories, ensuring accurate size reporting for deleted directories.
Key code changes include:
NSSummaryclass and its codec to track the number and size of deleted files and directories, as well as the set of deleted child directories.NSSummaryobjects now include these new deleted-tracking fields, with backward compatibility for older data.NSSummaryTaskWithFSOto properly update the deleted file and directory tracking fields inNSSummarywhen deletion events are received.NSSummary, rather than simply subtracting from the active file size/count.deletedChildDirset, and the deleted directory count is incremented.fetchSizeForDeletedDirectory) now consider both the deleted files and directories, preventing under-reporting of disk usage when files are deleted after their parent directory.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13479
How was this patch tested?
Tested out manually