sodonnel commented on a change in pull request #328: HDDS-2671 Have 
NodeManager.getNodeStatus throw NodeNotFoundException
URL: https://github.com/apache/hadoop-ozone/pull/328#discussion_r358890748
 
 

 ##########
 File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
 ##########
 @@ -785,6 +787,20 @@ private void sendDeleteCommand(final ContainerInfo 
container,
     tracker.accept(new InflightAction(datanode, Time.monotonicNow()));
   }
 
+  /**
+   * Wrap the call to nodeManager.getNodeStatus, catching any
+   * NodeNotFoundException and instead throwing a RuntimeException.
+   * @param dn The datanodeDetails to obtain the NodeStatus for
+   * @return NodeStatus corresponding to the given Datanode.
+   */
+  private NodeStatus getNodeStatus(DatanodeDetails dn) {
+    try {
+      return nodeManager.getNodeStatus(dn);
+    } catch (NodeNotFoundException e) {
+      throw new RuntimeException("Unable to find NodeStatus for "+dn, e);
 
 Review comment:
   Yea that makes sense. This means that is a "real" runtime exception occurs, 
the catch will not stop it propagating up the stack and instead we only catch 
this more specific exception. I have made this change.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to