HDDS-1310. In datanode once a container becomes unhealthy, datanode restart fails.

Signed-off-by: Nanda kumar <nanda@apache.org>
(cherry picked from commit 5c0a81ad3c)
This commit is contained in:
Sandeep Nemuri 2019-03-26 15:44:18 +05:30 committed by Nanda kumar
parent eed623ad61
commit f6acbc9caf
2 changed files with 16 additions and 0 deletions

View File

@ -618,6 +618,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);

View File

@ -332,6 +332,19 @@ public class TestKeyValueContainer {
keyValueContainerData.getState());
}
@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);