devmadhuu opened a new pull request, #8823:
URL: https://github.com/apache/ozone/pull/8823
## What changes were proposed in this pull request?
This PR change is to address the issue of memory leak in NSSummary map when
lot of files and directories gets deleted and some orphan dir links gets
unlinked from NSSummary tree, then they can lie in map for ever. So once the
directories and files are completely deleted from Ozone including
`deletedTable` and `deletedDirTable`, then we should cleanup the entries from
NSSummary map as well as NSSummary table.
**Key Changes Made:**
1. `NSSummaryTaskWithFSO.java:`
- Extended `getTaskTables()` to include DELETED_TABLE and
DELETED_DIR_TABLE for monitoring hard delete operations
- Added `handleUpdateOnDeletedTable()` method to properly handle DELETE
operations on `deletedTable`
- Added `handleUpdateOnDeletedDirTable()` method to properly handle
DELETE operations on `deletedDirTable`
- Both methods now remove corresponding entries from `nsSummaryMap` and
delete them from the database to prevent memory leaks
2. Memory Leak Fix Logic:
- For files: When entries are removed from `deletedTable` (hard delete),
we update the parent directory's NSSummary to decrement file count, size, and
file size
buckets
- For directories: When entries are removed from `deletedDirTable` (hard
delete), we remove the directory's NSSummary entry and update the parent
directory to
remove the child directory reference
- Database cleanup: Added calls to `deleteNSSummary()` to ensure entries
are properly removed from the database, not just from the in-memory map
3. Test Implementation:
- Fixed the OmKeyInfo.Builder NPE by adding all required fields
(setFileName, setCreationTime, setModificationTime, etc.)
- Created a comprehensive test that simulates the soft delete → hard
delete flow
- The test validates that NSSummary objects are properly cleaned up
during hard delete operations
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-8565
(Please replace this section with the link to the Apache JIRA)
Tested by running docker and existing integration and unit tests.
--
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]