priyeshkaratha commented on code in PR #8251:
URL: https://github.com/apache/ozone/pull/8251#discussion_r2048277225


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -627,52 +670,78 @@ public HddsProtos.Node queryNode(UUID uuid)
             .build();
       }
     } catch (NodeNotFoundException e) {
-      throw new IOException(
+      IOException ex = new IOException(
           "An unexpected error occurred querying the NodeStatus", e);
+      AUDIT.logReadFailure(buildAuditMessageForFailure(
+          SCMAction.QUERY_NODE, auditMap, ex));
+      throw ex;
     }
+    AUDIT.logReadSuccess(buildAuditMessageForSuccess(
+        SCMAction.QUERY_NODE, auditMap));
     return result;
   }
 
   @Override
   public List<DatanodeAdminError> decommissionNodes(List<String> nodes, 
boolean force)
       throws IOException {
+    final Map<String, String> auditMap = Maps.newHashMap();
+    auditMap.put("nodes", String.valueOf(nodes));
+    auditMap.put("force", String.valueOf(force));
+
     try {
       getScm().checkAdminAccess(getRemoteUser(), false);
-      return scm.getScmDecommissionManager().decommissionNodes(nodes, force);
+      List<DatanodeAdminError> result =  
scm.getScmDecommissionManager().decommissionNodes(nodes, force);
+      AUDIT.logWriteSuccess(buildAuditMessageForSuccess(
+          SCMAction.DECOMMISSION_NODES, auditMap));
+      return result;
     } catch (Exception ex) {

Review Comment:
   Keeping Exception since it is better because it handles unchecked exceptions



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