siddhantsangwan commented on code in PR #8014: URL: https://github.com/apache/ozone/pull/8014#discussion_r1984957771
########## hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/health/QuasiClosedStuckReplicationCheck.java: ########## @@ -0,0 +1,129 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.hdds.scm.container.replication.health; + +import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState.QUASI_CLOSED; + +import java.util.Set; +import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReplicaProto.State; +import org.apache.hadoop.hdds.scm.container.ContainerInfo; +import org.apache.hadoop.hdds.scm.container.ContainerReplica; +import org.apache.hadoop.hdds.scm.container.ReplicationManagerReport; +import org.apache.hadoop.hdds.scm.container.replication.ContainerCheckRequest; +import org.apache.hadoop.hdds.scm.container.replication.ContainerHealthResult; +import org.apache.hadoop.hdds.scm.container.replication.ContainerReplicaOp; +import org.apache.hadoop.hdds.scm.container.replication.QuasiClosedStuckReplicaCount; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Class to check for the replication of the replicas in quasi-closed stuck containers. As we want to maintain + * as much data and information as possible, the rule for QC stuck container is to maintain 2 copies of each origin + * if there is more than 1 origin. If there is only 1 origin, then we need to maintain 3 copies. + */ +public class QuasiClosedStuckReplicationCheck extends AbstractCheck { + public static final Logger LOG = LoggerFactory.getLogger(QuasiClosedStuckReplicationCheck.class); + + public static boolean shouldHandleAsQuasiClosedStuck(ContainerInfo containerInfo, Set<ContainerReplica> replicas) { + if (containerInfo.getState() != QUASI_CLOSED) { + return false; + } + if (!QuasiClosedContainerHandler.isQuasiClosedStuck(containerInfo, replicas)) { + return false; + } + if (hasEnoughOriginsWithOpen(containerInfo, replicas)) { + // If we have all origins with open replicas, and not unhealthy then the container should close after the close + // goes through, so this handler should not run. + return false; Review Comment: I need some more clarity on this one. Are we waiting for the open replicas to move to quasi_closed first? So there's a mix of open and quasi_closed replicas right now? `hasEnoughOriginsWithOpen` also counts quasi_closed replicas, not clear about that as well. -- 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]
