sumitagrawl commented on code in PR #5517:
URL: https://github.com/apache/ozone/pull/5517#discussion_r1544535601


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskWithLegacy.java:
##########
@@ -206,12 +131,118 @@ public boolean processWithLegacy(OMUpdateEventBatch 
events) {
     return true;
   }
 
+  private void processWithFileSystemLayout(OmKeyInfo updatedKeyInfo,
+                                           OmKeyInfo oldKeyInfo,
+                                           OMDBUpdateEvent.OMDBUpdateAction 
action,
+                                           Map<Long, NSSummary> nsSummaryMap)
+      throws IOException {
+    setKeyParentID(updatedKeyInfo);
+
+    if (!updatedKeyInfo.getKeyName().endsWith(OM_KEY_PREFIX)) {
+      switch (action) {
+      case PUT:
+        handlePutKeyEvent(updatedKeyInfo, nsSummaryMap);
+        break;
+
+      case DELETE:
+        handleDeleteKeyEvent(updatedKeyInfo, nsSummaryMap);
+        break;
+
+      case UPDATE:
+        if (oldKeyInfo != null) {
+          setKeyParentID(oldKeyInfo);
+          handleDeleteKeyEvent(oldKeyInfo, nsSummaryMap);
+        } else {
+          LOG.warn("Update event does not have the old keyInfo for {}.",
+              updatedKeyInfo.getKeyName());
+        }
+        handlePutKeyEvent(updatedKeyInfo, nsSummaryMap);
+        break;
+
+      default:
+        LOG.debug("Skipping DB update event fir Key: {}", action);
+      }
+    } else {
+      OmDirectoryInfo updatedDirectoryInfo = new OmDirectoryInfo.Builder()
+          .setName(updatedKeyInfo.getKeyName())
+          .setObjectID(updatedKeyInfo.getObjectID())
+          .setParentObjectID(updatedKeyInfo.getParentObjectID())
+          .build();
+
+      OmDirectoryInfo oldDirectoryInfo = null;
+
+      if (oldKeyInfo != null) {
+        oldDirectoryInfo =
+            new OmDirectoryInfo.Builder()
+                .setName(oldKeyInfo.getKeyName())
+                .setObjectID(oldKeyInfo.getObjectID())
+                .setParentObjectID(oldKeyInfo.getParentObjectID())
+                .build();
+      }
+
+      switch (action) {
+      case PUT:
+        handlePutDirEvent(updatedDirectoryInfo, nsSummaryMap);
+        break;
+
+      case DELETE:
+        handleDeleteDirEvent(updatedDirectoryInfo, nsSummaryMap);
+        break;
+
+      case UPDATE:
+        if (oldDirectoryInfo != null) {
+          handleDeleteDirEvent(oldDirectoryInfo, nsSummaryMap);
+        } else {
+          LOG.warn("Update event does not have the old dirInfo for {}.",
+              updatedKeyInfo.getKeyName());
+        }
+        handlePutDirEvent(updatedDirectoryInfo, nsSummaryMap);
+        break;
+
+      default:
+        LOG.debug("Skipping DB update event for Directory: {}", action);

Review Comment:
   IMO, isDebugEnabled() check is not required, as debug() itself have first 
check as enabled and there is no expression evaluation, so this will not cause 
any performance impact.



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