devmadhuu commented on code in PR #9213:
URL: https://github.com/apache/ozone/pull/9213#discussion_r2471700774


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskDbEventHandler.java:
##########
@@ -141,33 +142,29 @@ protected void handlePutDirEvent(OmDirectoryInfo 
directoryInfo,
     long existingReplicatedSizeOfFiles = directoryAlreadyExists ? 
curNSSummary.getReplicatedSizeOfFiles() : 0;
 
     if (curNSSummary == null) {
-      // If we don't have it locally and in the DB we create a new instance
-      // as this is a new ID
       curNSSummary = new NSSummary();
     }
     curNSSummary.setDirName(dirName);
-    // Set the parent directory ID
     curNSSummary.setParentId(parentObjectId);
     nsSummaryMap.put(objectId, curNSSummary);
 
-    // 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);
+    // Get or create the parent's NSSummary
+    NSSummary parentNSSummary = nsSummaryMap.get(parentObjectId);
+    if (parentNSSummary == null) {
+      parentNSSummary = 
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 (parentNSSummary == null) {

Review Comment:
   Pls add comment here in what cases parent can be null for a node and even 
not present in DB.



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskDbEventHandler.java:
##########
@@ -141,33 +142,29 @@ protected void handlePutDirEvent(OmDirectoryInfo 
directoryInfo,
     long existingReplicatedSizeOfFiles = directoryAlreadyExists ? 
curNSSummary.getReplicatedSizeOfFiles() : 0;
 
     if (curNSSummary == null) {

Review Comment:
   Can we use `directoryAlreadyExists` variable here as we already did null 
check above ?



-- 
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]

Reply via email to