HDFS-12256. Ozone : handle inactive containers on DataNode. Contributed by Chen Liang.
This commit is contained in:
parent
77d4b18700
commit
607d1fcd31
|
@ -30,7 +30,6 @@ import org.apache.hadoop.ozone.container.common.helpers.ContainerData;
|
||||||
*/
|
*/
|
||||||
public class ContainerStatus {
|
public class ContainerStatus {
|
||||||
private final ContainerData containerData;
|
private final ContainerData containerData;
|
||||||
private final boolean active;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of pending deletion blocks in container.
|
* Number of pending deletion blocks in container.
|
||||||
|
@ -41,12 +40,10 @@ public class ContainerStatus {
|
||||||
* Creates a Container Status class.
|
* Creates a Container Status class.
|
||||||
*
|
*
|
||||||
* @param containerData - ContainerData.
|
* @param containerData - ContainerData.
|
||||||
* @param active - Active or not active.
|
|
||||||
*/
|
*/
|
||||||
ContainerStatus(ContainerData containerData, boolean active) {
|
ContainerStatus(ContainerData containerData) {
|
||||||
this.numPendingDeletionBlocks = 0;
|
this.numPendingDeletionBlocks = 0;
|
||||||
this.containerData = containerData;
|
this.containerData = containerData;
|
||||||
this.active = active;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,19 +53,7 @@ public class ContainerStatus {
|
||||||
* @return ContainerData.
|
* @return ContainerData.
|
||||||
*/
|
*/
|
||||||
public ContainerData getContainer() {
|
public ContainerData getContainer() {
|
||||||
if (active) {
|
return containerData;
|
||||||
return containerData;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if a container is Active.
|
|
||||||
*
|
|
||||||
* @return true if it is active.
|
|
||||||
*/
|
|
||||||
public boolean isActive() {
|
|
||||||
return active;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class TestContainerPersistence {
|
||||||
ContainerStatus status = containerManager
|
ContainerStatus status = containerManager
|
||||||
.getContainerMap().get(containerName);
|
.getContainerMap().get(containerName);
|
||||||
|
|
||||||
Assert.assertTrue(status.isActive());
|
Assert.assertNotNull(status.getContainer());
|
||||||
Assert.assertNotNull(status.getContainer().getContainerPath());
|
Assert.assertNotNull(status.getContainer().getContainerPath());
|
||||||
Assert.assertNotNull(status.getContainer().getDBPath());
|
Assert.assertNotNull(status.getContainer().getDBPath());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue