sodonnel commented on code in PR #6449:
URL: https://github.com/apache/ozone/pull/6449#discussion_r1556025968


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java:
##########
@@ -384,6 +387,12 @@ private XceiverClientReply sendCommandWithRetry(
       }
     }
 
+    boolean allInService = datanodeList.stream()

Review Comment:
   Change seems sensible to me. I tried to think if there was a nicer way to do 
this, and thought that the following was easier to follow:
   
   ```
       Iterator<DatanodeDetails> iter = datanodeList.iterator();
       List<DatanodeDetails> notInService = null;
       while(iter.hasNext()) {
         DatanodeDetails dn = iter.next();
         if (dn.getPersistedOpState() != 
HddsProtos.NodeOperationalState.IN_SERVICE) {
           iter.remove();
           if (notInService == null) {
             notInService = new ArrayList<>();
           }
           notInService.add(dn);
         }
       }
       if (notInService != null) {
         datanodeList.addAll(notInService);
       }
   ```
   
   It could be shorter, but I tried to avoid allocating a list for notInService 
unless it was really needed, as it won't be needed most of the time.
   
   Only change this if you feel it is better - I am not insisting it should be 
changed.



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