Search in sources :

Example 1 with ReconContainerManager

use of org.apache.hadoop.ozone.recon.scm.ReconContainerManager in project ozone by apache.

the class TestReconTasks method testMissingContainerDownNode.

@Test
public void testMissingContainerDownNode() throws Exception {
    ReconStorageContainerManagerFacade reconScm = (ReconStorageContainerManagerFacade) cluster.getReconServer().getReconStorageContainerManager();
    StorageContainerManager scm = cluster.getStorageContainerManager();
    PipelineManager reconPipelineManager = reconScm.getPipelineManager();
    PipelineManager scmPipelineManager = scm.getPipelineManager();
    // Make sure Recon's pipeline state is initialized.
    LambdaTestUtils.await(60000, 5000, () -> (reconPipelineManager.getPipelines().size() >= 1));
    ContainerManager scmContainerManager = scm.getContainerManager();
    ReconContainerManager reconContainerManager = (ReconContainerManager) reconScm.getContainerManager();
    ContainerInfo containerInfo = scmContainerManager.allocateContainer(RatisReplicationConfig.getInstance(ONE), "test");
    long containerID = containerInfo.getContainerID();
    Pipeline pipeline = scmPipelineManager.getPipeline(containerInfo.getPipelineID());
    XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf);
    runTestOzoneContainerViaDataNode(containerID, client);
    // Make sure Recon got the container report with new container.
    Assert.assertEquals(scmContainerManager.getContainerIDs(), reconContainerManager.getContainerIDs());
    // Bring down the Datanode that had the container replica.
    cluster.shutdownHddsDatanode(pipeline.getFirstNode());
    LambdaTestUtils.await(120000, 10000, () -> {
        List<UnhealthyContainers> allMissingContainers = reconContainerManager.getContainerSchemaManager().getUnhealthyContainers(ContainerSchemaDefinition.UnHealthyContainerStates.MISSING, 0, 1000);
        return (allMissingContainers.size() == 1);
    });
    // Restart the Datanode to make sure we remove the missing container.
    cluster.restartHddsDatanode(pipeline.getFirstNode(), true);
    LambdaTestUtils.await(120000, 10000, () -> {
        List<UnhealthyContainers> allMissingContainers = reconContainerManager.getContainerSchemaManager().getUnhealthyContainers(ContainerSchemaDefinition.UnHealthyContainerStates.MISSING, 0, 1000);
        return (allMissingContainers.isEmpty());
    });
}
Also used : ReconStorageContainerManagerFacade(org.apache.hadoop.ozone.recon.scm.ReconStorageContainerManagerFacade) StorageContainerManager(org.apache.hadoop.hdds.scm.server.StorageContainerManager) ContainerManager(org.apache.hadoop.hdds.scm.container.ContainerManager) StorageContainerManager(org.apache.hadoop.hdds.scm.server.StorageContainerManager) ReconContainerManager(org.apache.hadoop.ozone.recon.scm.ReconContainerManager) ReconContainerManager(org.apache.hadoop.ozone.recon.scm.ReconContainerManager) PipelineManager(org.apache.hadoop.hdds.scm.pipeline.PipelineManager) XceiverClientGrpc(org.apache.hadoop.hdds.scm.XceiverClientGrpc) UnhealthyContainers(org.hadoop.ozone.recon.schema.tables.pojos.UnhealthyContainers) ContainerInfo(org.apache.hadoop.hdds.scm.container.ContainerInfo) Pipeline(org.apache.hadoop.hdds.scm.pipeline.Pipeline) Test(org.junit.Test)

Aggregations

XceiverClientGrpc (org.apache.hadoop.hdds.scm.XceiverClientGrpc)1 ContainerInfo (org.apache.hadoop.hdds.scm.container.ContainerInfo)1 ContainerManager (org.apache.hadoop.hdds.scm.container.ContainerManager)1 Pipeline (org.apache.hadoop.hdds.scm.pipeline.Pipeline)1 PipelineManager (org.apache.hadoop.hdds.scm.pipeline.PipelineManager)1 StorageContainerManager (org.apache.hadoop.hdds.scm.server.StorageContainerManager)1 ReconContainerManager (org.apache.hadoop.ozone.recon.scm.ReconContainerManager)1 ReconStorageContainerManagerFacade (org.apache.hadoop.ozone.recon.scm.ReconStorageContainerManagerFacade)1 UnhealthyContainers (org.hadoop.ozone.recon.schema.tables.pojos.UnhealthyContainers)1 Test (org.junit.Test)1