sumitagrawl commented on code in PR #4049:
URL: https://github.com/apache/ozone/pull/4049#discussion_r1046690136
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerManagerFacade.java:
##########
@@ -331,7 +339,10 @@ public void start() {
initializePipelinesFromScm();
}
getDatanodeProtocolServer().start();
- this.reconScmTasks.forEach(ReconScmTask::start);
+ reconSafeModeMgrTask.start();
Review Comment:
This is a blocking call for Recon Constructor, and no one will be able to
communicate for the 5 minute. Even SCM sync is not enabled during this time.
Can this is refactored to avoid impacted services like health task or
others, and to be non-blocking.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ReconSafeModeMgrTask.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.fsck;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.scm.container.ContainerID;
+import org.apache.hadoop.hdds.scm.container.ContainerInfo;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
+import org.apache.hadoop.hdds.scm.node.states.NodeNotFoundException;
+import org.apache.hadoop.ozone.recon.scm.ReconNodeManager;
+import org.apache.hadoop.ozone.recon.scm.ReconSafeModeManager;
+import org.apache.hadoop.ozone.recon.tasks.ReconTaskConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Class that scans the list of containers and keeps track if
+ * recon warm up completed and it emits safe node.
+ */
+public class ReconSafeModeMgrTask {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(ReconSafeModeMgrTask.class);
+
+ private ContainerManager containerManager;
+ private ReconNodeManager nodeManager;
+ private ReconSafeModeManager safeModeManager;
+ private List<DatanodeDetails> allNodes;
+ private List<ContainerInfo> containers;
+ private final long interval;
+
+ public ReconSafeModeMgrTask(
+ ContainerManager containerManager,
+ ReconNodeManager nodeManager,
+ ReconSafeModeManager safeModeManager,
+ ReconTaskConfig reconTaskConfig) {
+ this.safeModeManager = safeModeManager;
+ this.containerManager = containerManager;
+ this.nodeManager = nodeManager;
+ this.allNodes = nodeManager.getAllNodes();
+ this.containers = containerManager.getContainers();
+ interval = reconTaskConfig.getSafeModeWaitThreshold().toMillis();
+ }
+
+ public synchronized void start() {
+ try {
+ checkForReconToEmitSafeNode();
+ if (safeModeManager.getInSafeMode()) {
+ wait(interval);
+ allNodes = nodeManager.getAllNodes();
+ containers = containerManager.getContainers();
+ checkForReconToEmitSafeNode();
Review Comment:
No meaning of this check as next statement is always comming out of safemode.
--
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]