sadanand48 commented on code in PR #11962:
URL: https://github.com/apache/ozone/pull/11962#discussion_r4657274348


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/report/CommandStatusReportPublisher.java:
##########
@@ -63,21 +65,31 @@ protected long getReportFrequency() {
 
   @Override
   protected CommandStatusReportsProto getReport() {
+    return null;
+  }
+
+  @Override
+  protected List<CommandStatusReportsProto> getIncrementalReports() {
     Map<Long, CommandStatus> map = this.getContext()
         .getCommandStatusMap();
     Iterator<Long> iterator = map.keySet().iterator();
-    CommandStatusReportsProto.Builder builder = CommandStatusReportsProto
-        .newBuilder();
+    List<CommandStatusReportsProto> reports = new ArrayList<>();
 
-    iterator.forEachRemaining(key -> {
+    while (iterator.hasNext()) {
+      Long key = iterator.next();
       CommandStatus cmdStatus = map.get(key);
+      if (cmdStatus == null) {
+        continue;
+      }
+      reports.add(CommandStatusReportsProto.newBuilder()
+          .addCmdStatus(cmdStatus.getProtoBufMessage())
+          .build());
       // If status is still pending then don't remove it from map as
       // CommandHandler will change its status when it works on this command.
       if (!cmdStatus.getStatus().equals(Status.PENDING)) {
         map.remove(key);
       }

Review Comment:
    fixed. CommandStatusReportPublisher now uses computeIfPresent, matching the 
per-key atomic operation used by StateContext.updateCommandStatus



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