swagle commented on a change in pull request #546: HDDS-2847. Recon should 
track containers that are missing along with …
URL: https://github.com/apache/hadoop-ozone/pull/546#discussion_r380888986
 
 

 ##########
 File path: 
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconContainerReportHandler.java
 ##########
 @@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.recon.scm;
+
+import java.io.IOException;
+import java.util.List;
+
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReplicaProto;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReportsProto;
+import org.apache.hadoop.hdds.scm.container.ContainerID;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
+import org.apache.hadoop.hdds.scm.container.ContainerReportHandler;
+import 
org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
+import org.apache.hadoop.hdds.scm.node.NodeManager;
+import 
org.apache.hadoop.hdds.scm.server.SCMDatanodeHeartbeatDispatcher.ContainerReportFromDatanode;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Recon's container report handler.
+ */
+public class ReconContainerReportHandler extends ContainerReportHandler {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(ReconContainerReportHandler.class);
+  private StorageContainerServiceProvider scmClient;
+
+  public ReconContainerReportHandler(NodeManager nodeManager,
+                                     ContainerManager containerManager,
+                                     StorageContainerServiceProvider scm) {
+    super(nodeManager, containerManager);
+    this.scmClient = scm;
+  }
+
+  @Override
+  public void onMessage(final ContainerReportFromDatanode reportFromDatanode,
+                        final EventPublisher publisher) {
+
+    final ContainerReportsProto containerReport =
+        reportFromDatanode.getReport();
+    ReconContainerManager containerManager =
+        (ReconContainerManager) getContainerManager();
+
+    List<ContainerReplicaProto> reportsList = containerReport.getReportsList();
+    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.info("Verified new container from SCM {} ",
 
 Review comment:
   Looks like too many LOG.info messages!

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


With regards,
Apache Git Services

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