kerneltime commented on a change in pull request #3085:
URL: https://github.com/apache/ozone/pull/3085#discussion_r808552677



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReportHandler.java
##########
@@ -123,22 +121,30 @@ public void onMessage(final ContainerReportFromDatanode 
reportFromDatanode,
         final Set<ContainerID> containersInSCM =
             nodeManager.getContainers(datanodeDetails);
 
-        final Set<ContainerID> containersInDn = replicas.parallelStream()
-            .map(ContainerReplicaProto::getContainerID)
-            .map(ContainerID::valueOf).collect(Collectors.toSet());
-
-        final Set<ContainerID> missingReplicas = new 
HashSet<>(containersInSCM);
-        missingReplicas.removeAll(containersInDn);
-
-        processContainerReplicas(datanodeDetails, replicas, publisher);
-        processMissingReplicas(datanodeDetails, missingReplicas);
-
-        /*
-         * Update the latest set of containers for this datanode in
-         * NodeManager
-         */
-        nodeManager.setContainers(datanodeDetails, containersInDn);
-
+        for (ContainerReplicaProto replica : replicas) {
+          ContainerID cid = ContainerID.valueOf(replica.getContainerID());
+          ContainerInfo container = null;
+          try {
+            // We get the container using the ContainerID object we obtained
+            // from protobuf. However we don't want to store that object if
+            // there is already an instance for the same ContainerID we can
+            // reuse.
+            container = containerManager.getContainer(cid);
+            cid = container.containerID();
+          } catch (ContainerNotFoundException e) {
+            // Ignore this for now. It will be handle later with a null check.

Review comment:
       ```suggestion
               // Ignore this for now. It will be handled later with a null 
check.
   ```




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