sumitagrawl commented on code in PR #4011:
URL: https://github.com/apache/ozone/pull/4011#discussion_r1040455535
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/PipelineSyncTask.java:
##########
@@ -66,21 +71,34 @@ public PipelineSyncTask(ReconPipelineManager
pipelineManager,
@Override
protected synchronized void run() {
try {
+ lock.writeLock().lock();
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();
+ triggerPipelineSyncTask();
wait(interval);
}
} catch (Throwable t) {
LOG.error("Exception in Pipeline sync Thread.", t);
if (t instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void triggerPipelineSyncTask()
+ throws IOException, TimeoutException, NodeNotFoundException {
+ try {
+ lock.writeLock().lock();
+ long start = Time.monotonicNow();
+ List<Pipeline> pipelinesFromScm = scmClient.getPipelines();
+ reconPipelineManager.initializePipelines(pipelinesFromScm);
+ syncOperationalStateOnDeadNodes();
Review Comment:
The trigger is on stale node, please check if applicable or not, as method
indicate for deadnode sync.
Additionally do this required for Deadnode handler or healthCheck trigger is
enough ?
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ContainerHealthTask.java:
##########
@@ -79,32 +83,44 @@ public ContainerHealthTask(
}
@Override
- public synchronized void run() {
+ public void run() {
try {
+ lock.writeLock().lock();
Review Comment:
Since writelock is taken before while loop, then external trigger will
always wait for the writelock, deadlock situation.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/PipelineSyncTask.java:
##########
@@ -66,21 +71,34 @@ public PipelineSyncTask(ReconPipelineManager
pipelineManager,
@Override
protected synchronized void run() {
try {
+ lock.writeLock().lock();
Review Comment:
writelock is taken outside while loop, external trigger can never happen and
will cause deadlock
##########
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(ReconDeadNodeHandler.class);
Review Comment:
logger classname is wrong, should be ReconStalNodeHandler
--
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]