You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by aj...@apache.org on 2019/03/22 22:53:33 UTC

[hadoop] branch trunk updated: HDDS-1310. In datanode once a container becomes unhealthy, datanode restart fails. Contributed by Sandeep Nemuri.

This is an automated email from the ASF dual-hosted git repository.

ajay pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new efad571  HDDS-1310. In datanode once a container becomes unhealthy, datanode restart fails. Contributed by  Sandeep Nemuri.
efad571 is described below

commit efad5717ec1facbbe8a5a2c7adcaa47d5c1592ac
Author: Ajay Kumar <aj...@apache.org>
AuthorDate: Fri Mar 22 15:53:12 2019 -0700

    HDDS-1310. In datanode once a container becomes unhealthy, datanode restart fails. Contributed by  Sandeep Nemuri.
---
 .../hadoop/ozone/container/keyvalue/KeyValueContainer.java  |  3 +++
 .../ozone/container/keyvalue/TestKeyValueContainer.java     | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
index 47af110..26b0ce1 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
@@ -623,6 +623,9 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
     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);
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
index c7c08b0..1aa7361 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
@@ -333,6 +333,19 @@ public class TestKeyValueContainer {
   }
 
   @Test
+  public void testReportOfUnhealthyContainer() throws Exception {
+    keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
+    Assert.assertNotNull(keyValueContainer.getContainerReport());
+    keyValueContainer.markContainerUnhealthy();
+    File containerFile = keyValueContainer.getContainerFile();
+    keyValueContainerData = (KeyValueContainerData) ContainerDataYaml
+        .readContainerFile(containerFile);
+    assertEquals(ContainerProtos.ContainerDataProto.State.UNHEALTHY,
+        keyValueContainerData.getState());
+    Assert.assertNotNull(keyValueContainer.getContainerReport());
+  }
+
+  @Test
   public void testUpdateContainer() throws IOException {
     keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
     Map<String, String> metadata = new HashMap<>();


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