dineshchitlangia commented on a change in pull request #1000:
URL: https://github.com/apache/hadoop-ozone/pull/1000#discussion_r434974495



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/AbstractContainerReportHandler.java
##########
@@ -225,14 +218,35 @@ private void updateContainerState(final DatanodeDetails 
datanode,
     }
   }
 
+  private void updateContainerReplica(final DatanodeDetails datanodeDetails,
+                                      final ContainerID containerId,
+                                      final ContainerReplicaProto replicaProto)
+      throws ContainerNotFoundException, ContainerReplicaNotFoundException {
+    final ContainerReplica replica = ContainerReplica.newBuilder()
+        .setContainerID(containerId)
+        .setContainerState(replicaProto.getState())
+        .setDatanodeDetails(datanodeDetails)
+        .setOriginNodeId(UUID.fromString(replicaProto.getOriginNodeId()))
+        .setSequenceId(replicaProto.getBlockCommitSequenceId())
+        .build();
+
+    if (replica.getState().equals(State.DELETED)) {
+      containerManager.removeContainerReplica(containerId, replica);
+    } else {
+      containerManager.updateContainerReplica(containerId, replica);
+    }
+  }
+
   /**
    * Returns true if the container replica is not marked as UNHEALTHY.
    *
    * @param replicaState State of the container replica.
    * @return true if unhealthy, false otherwise
    */
   private boolean isUnhealthy(final Supplier<State> replicaState) {

Review comment:
       NIT: Update javadocs




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



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