You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2019/11/15 22:58:50 UTC

[GitHub] [hadoop-ozone] sodonnel commented on a change in pull request #160: Hdds 1880 decom datanodework

sodonnel commented on a change in pull request #160: Hdds 1880 decom datanodework
URL: https://github.com/apache/hadoop-ozone/pull/160#discussion_r347044615
 
 

 ##########
 File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
 ##########
 @@ -664,37 +669,60 @@ public ContainerReplicaProto getContainerReport()
 
   /**
    * Returns LifeCycle State of the container.
+   *
    * @return LifeCycle State of the container in HddsProtos format
    * @throws StorageContainerException
    */
-  private ContainerReplicaProto.State getHddsState()
+  private ContainerReplicaProto.State getHddsState(
+      HddsProtos.NodeOperationalState nodeState)
       throws StorageContainerException {
-    ContainerReplicaProto.State state;
-    switch (containerData.getState()) {
-    case OPEN:
-      state = ContainerReplicaProto.State.OPEN;
-      break;
-    case CLOSING:
-      state = ContainerReplicaProto.State.CLOSING;
-      break;
-    case QUASI_CLOSED:
-      state = ContainerReplicaProto.State.QUASI_CLOSED;
-      break;
-    case CLOSED:
-      state = ContainerReplicaProto.State.CLOSED;
-      break;
-    case UNHEALTHY:
-      state = ContainerReplicaProto.State.UNHEALTHY;
-      break;
-    default:
-      throw new StorageContainerException("Invalid Container state found: " +
-          containerData.getContainerID(), INVALID_CONTAINER_STATE);
+    ContainerReplicaProto.State state = ContainerReplicaProto.State.INVALID;
+    if (nodeState == HddsProtos.NodeOperationalState.IN_SERVICE) {
+      switch (containerData.getState()) {
+      case OPEN:
+        state = ContainerReplicaProto.State.OPEN;
+        break;
+      case CLOSING:
+        state = ContainerReplicaProto.State.CLOSING;
+        break;
+      case QUASI_CLOSED:
+        state = ContainerReplicaProto.State.QUASI_CLOSED;
+        break;
+      case CLOSED:
+        state = ContainerReplicaProto.State.CLOSED;
+        break;
+      case UNHEALTHY:
+        state = ContainerReplicaProto.State.UNHEALTHY;
+        break;
+      default:
+        throw new StorageContainerException("Invalid Container state found: " +
+            containerData.getContainerID(), INVALID_CONTAINER_STATE);
+      }
+    }
+
+    // If this node has been marked as Decommissioned or is under going
+    // Decommission, we report all containers as DECOM_PLEASE_IGNORE state.
+    // This allows SCM to know that these containers need to be managed in
+    // a different way.
+    if (nodeState == HddsProtos.NodeOperationalState.DECOMMISSIONED ||
+        nodeState == HddsProtos.NodeOperationalState.DECOMMISSIONING) {
+      state = ContainerReplicaProto.State.DECOM_PLEASE_IGNORE;
+    }
+
+    // If we are in maintenance mode, this is a request to SCM/Replica
+    // manager to not start replication immediately; since we are making a
+    // promise to the SCM that these containers will soon be operational.
+
+    if (nodeState == HddsProtos.NodeOperationalState.ENTERING_MAINTENANCE ||
+        nodeState == HddsProtos.NodeOperationalState.IN_MAINTENANCE) {
+      state = ContainerReplicaProto.State.MAINT_CONSIDER_AVAILABLE;
 
 Review comment:
   Do we need to report only CLOSED containers as MAINT_CONSIDER_AVAILABLE / DECOM_PLEASE_IGNORE? Otherwise we will have no way on SCM to know if the replica is still open and we need to wait on the containers to close before replicating them etc.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org