From 607d1fcd31f37caa70285f93737d8cd24bd662e6 Mon Sep 17 00:00:00 2001 From: Xiaoyu Yao Date: Tue, 19 Sep 2017 13:07:17 -0700 Subject: [PATCH] HDFS-12256. Ozone : handle inactive containers on DataNode. Contributed by Chen Liang. --- .../common/impl/ContainerStatus.java | 19 ++----------------- .../common/impl/TestContainerPersistence.java | 2 +- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStatus.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStatus.java index 91c026cea77..183157d4030 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStatus.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStatus.java @@ -30,7 +30,6 @@ import org.apache.hadoop.ozone.container.common.helpers.ContainerData; */ public class ContainerStatus { private final ContainerData containerData; - private final boolean active; /** * Number of pending deletion blocks in container. @@ -41,12 +40,10 @@ public class ContainerStatus { * Creates a Container Status class. * * @param containerData - ContainerData. - * @param active - Active or not active. */ - ContainerStatus(ContainerData containerData, boolean active) { + ContainerStatus(ContainerData containerData) { this.numPendingDeletionBlocks = 0; this.containerData = containerData; - this.active = active; } /** @@ -56,19 +53,7 @@ public class ContainerStatus { * @return ContainerData. */ public ContainerData getContainer() { - if (active) { - return containerData; - } - return null; - } - - /** - * Indicates if a container is Active. - * - * @return true if it is active. - */ - public boolean isActive() { - return active; + return containerData; } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java index 5b2fce1df99..9083e47958a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java @@ -173,7 +173,7 @@ public class TestContainerPersistence { ContainerStatus status = containerManager .getContainerMap().get(containerName); - Assert.assertTrue(status.isActive()); + Assert.assertNotNull(status.getContainer()); Assert.assertNotNull(status.getContainer().getContainerPath()); Assert.assertNotNull(status.getContainer().getDBPath());