You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/03/03 07:16:27 UTC

[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #624: HDDS-3110. Fix race condition in Recon's container and pipeline handling.

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org