adoroszlai commented on a change in pull request #624: HDDS-3110. Fix race 
condition in Recon's container and pipeline handling.
URL: https://github.com/apache/hadoop-ozone/pull/624#discussion_r386834211
 
 

 ##########
 File path: 
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconContainerReportHandler.java
 ##########
 @@ -63,19 +63,21 @@ public void onMessage(final ContainerReportFromDatanode 
reportFromDatanode,
     for (ContainerReplicaProto containerReplicaProto : reportsList) {
       final ContainerID id = ContainerID.valueof(
           containerReplicaProto.getContainerID());
-      if (!getContainerManager().exists(id)) {
-        LOG.info("New container {} got from {}.", id,
-            reportFromDatanode.getDatanodeDetails());
-        try {
-          ContainerWithPipeline containerWithPipeline =
-              scmClient.getContainerWithPipeline(id.getId());
-          LOG.debug("Verified new container from SCM {} ",
-              containerWithPipeline.getContainerInfo().containerID());
-          containerManager.addNewContainer(id.getId(), containerWithPipeline);
-        } catch (IOException ioEx) {
-          LOG.error("Exception while getting new container info from SCM",
-              ioEx);
-          return;
+      synchronized (containerManager) {
+        if (!containerManager.exists(id)) {
+          LOG.info("New container {} got from {}.", id,
+              reportFromDatanode.getDatanodeDetails());
+          try {
+            ContainerWithPipeline containerWithPipeline =
+                scmClient.getContainerWithPipeline(id.getId());
 
 Review comment:
   Might this be improved in a followup to avoid RPC while holding the lock?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to