sumitagrawl commented on code in PR #12108: URL: https://github.com/apache/ozone/pull/12108#discussion_r4676671154
########## hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/SimplifiedContainerHealthStateForReporting.java: ########## @@ -0,0 +1,241 @@ +/* + * 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; + +/** + * Label that the SCM ReplicationManager (RM) gives a container after it checks the replicas. Used by the + * RM report, RM metrics, the container report CLI and filtering containers by label. + * + * <p>This is not the container lifecycle state. The label is kept only in SCM memory on + * {@link ContainerInfo}, and is not persisted or sent over RPC. Only the report counts are sent. + * + * <p>In one check, more than one RM handler can set a label. Each one is counted in the report, but + * {@link ContainerInfo} keeps only the last one. + * + * <p>Terms used below: + * <ul> + * <li>UNHEALTHY replica: a replica in the UNHEALTHY state. A datanode puts its replica in this state + * when it finds that the replica's data is corrupt or incomplete. This happens when: + * <ul> + * <li>a container scanner finds a missing or corrupt file or directory, a missing chunk, a chunk + * with the wrong length or a bad checksum, or a RocksDB it cannot open;</li> + * <li>a write to an OPEN, CLOSING or RECOVERING replica fails;</li> + * <li>on restart, the replica has a lower block commit sequence ID than the Ratis snapshot, so it + * missed some writes;</li> + * <li>an EC replica is still RECOVERING when its timeout ends or when the datanode restarts.</li> + * </ul> + * The datanode rejects client writes to an UNHEALTHY replica and will not close it. The replica can + * still be read and copied, and container reconciliation can still repair it. RM does not count + * UNHEALTHY replicas toward the replication factor, except in the labels whose names start with + * UNHEALTHY. For Ratis, SCM also treats a QUASI_CLOSED replica of a CLOSED container as UNHEALTHY if its + * sequence ID differs from the container's.</li> + * <li>Healthy replica: a replica that is not UNHEALTHY, in any other state (CLOSED, QUASI_CLOSED, + * CLOSING or OPEN) and on any node. This is about one replica and is not related to the + * {@link #HEALTHY} label.</li> + * <li>Offline node: a node that is decommissioning, decommissioned or in maintenance.</li> + * <li>Ratis counts: a replica on a decommissioning node does not count toward the replication factor. + * A replica on a maintenance node counts, as long as the configured minimum of replicas stays on + * in-service nodes.</li> + * </ul> + */ +public enum SimplifiedContainerHealthStateForReporting { Review Comment: These state are more related to replication concern, so we can name it as , **ContainerReplicationState**. Healthy - represents replication meeting defined criteria. And other various state reoresent error condition where replication is not proper or being in state where can not be termed proper replication like quasi-closed-stuck as special replication is done. cc: @szetszwo -- 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]
