sodonnel commented on code in PR #8014:
URL: https://github.com/apache/ozone/pull/8014#discussion_r1985307750


##########
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:
   My intended logic is that if you have 3 origin such that you have:
   
   QC - Origin 1
   QC - Origin 2
   Open - Origin 3
   
   Then this is not really QC stuck because the open one should go to QC and 
then you have enough replicas to closed it, as we have all 3 origins.
   
   The mis-matched-replicas-handler will issue the close command, but it also 
returns false always to let other handler run.
   
   I think then, if we do nothing the normal under replication handling would 
take care of under replication in this scenario, ie only have 2 replicas.
   
   If the OPEN replica never closes (don't think I have ever seen that occur in 
practice) I am not sure what we should do!



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