sumitagrawl commented on code in PR #4011:
URL: https://github.com/apache/ozone/pull/4011#discussion_r1045421970


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStaleNodeHandler.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.scm.node.NodeManager;
+import org.apache.hadoop.hdds.scm.node.StaleNodeHandler;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineManager;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Recon's handling of Stale node.
+ */
+public class ReconStaleNodeHandler extends StaleNodeHandler {
+
+  private static final Logger LOG =
+        LoggerFactory.getLogger(ReconStaleNodeHandler.class);
+  private PipelineSyncTask pipelineSyncTask;
+
+  public ReconStaleNodeHandler(NodeManager nodeManager,
+                                 PipelineManager pipelineManager,
+                                 OzoneConfiguration conf,
+                                 PipelineSyncTask pipelineSyncTask) {
+    super(nodeManager, pipelineManager, conf);
+    this.pipelineSyncTask = pipelineSyncTask;
+  }
+
+  @Override
+  public void onMessage(final DatanodeDetails datanodeDetails,
+                          final EventPublisher publisher) {
+    super.onMessage(datanodeDetails, publisher);
+    try {
+      pipelineSyncTask.triggerPipelineSyncTask();
+    } catch (Exception exp) {

Review Comment:
   do healthCheck required here to update health status?



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/PipelineSyncTask.java:
##########
@@ -64,17 +69,16 @@ public PipelineSyncTask(ReconPipelineManager 
pipelineManager,
   }
 
   @Override
-  protected synchronized void run() {
+  public void run() {
     try {
       while (canRun()) {
-        long start = Time.monotonicNow();
-        List<Pipeline> pipelinesFromScm = scmClient.getPipelines();
-        reconPipelineManager.initializePipelines(pipelinesFromScm);
-        syncOperationalStateOnDeadNodes();
-        LOG.info("Pipeline sync Thread took {} milliseconds.",
-            Time.monotonicNow() - start);
-        recordSingleRunCompletion();
-        wait(interval);
+        try {
+          lock.writeLock().lock();

Review Comment:
   We can remove taking lock here as lock is already taken inside for complete 
method. Plz handle for other place



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