devmadhuu commented on code in PR #4626:
URL: https://github.com/apache/ozone/pull/4626#discussion_r1219020001
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskDbEventHandler.java:
##########
@@ -133,25 +193,42 @@ protected void handlePutDirEvent(OmDirectoryInfo
directoryInfo,
}
curNSSummary.setDirName(dirName);
nsSummaryMap.put(objectId, curNSSummary);
-
+ removeFromOrphanIfExists(omDirectoryInfo, orphanKeyMetaDataMap);
// Write the child dir list to the parent directory
// Try to get the NSSummary from our local map that maps NSSummaries to IDs
NSSummary nsSummary = nsSummaryMap.get(parentObjectId);
if (nsSummary == null) {
// If we don't have it in this batch we try to get it from the DB
nsSummary = reconNamespaceSummaryManager.getNSSummary(parentObjectId);
- }
- if (nsSummary == null) {
- // If we don't have it locally and in the DB we create a new instance
- // as this is a new ID
- nsSummary = new NSSummary();
+ if (nsSummary == null) {
+ // If we don't have it locally and in the DB we create a new instance
+ // as this is a new ID
+ nsSummary = new NSSummary();
+ addOrphanCandidate(omDirectoryInfo, orphanKeyMetaDataMap,
+ status, false);
+ } else {
+ addOrphanCandidate(omDirectoryInfo, orphanKeyMetaDataMap,
+ status, true);
+ }
}
nsSummary.addChildDir(objectId);
nsSummaryMap.put(parentObjectId, nsSummary);
}
- protected void handleDeleteKeyEvent(OmKeyInfo keyInfo,
- Map<Long, NSSummary> nsSummaryMap)
+ private <T extends WithParentObjectId> void removeFromOrphanIfExists(
+ T fileDirInfo,
+ Map<Long, OrphanKeyMetaData> orphanKeyMetaDataMap) throws IOException {
+ if (null != orphanKeyMetaDataMap) {
Review Comment:
Done.
--
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]