Search in sources :

Example 6 with SCMHAManager

use of org.apache.hadoop.hdds.scm.ha.SCMHAManager in project ozone by apache.

the class TestSimplePipelineProvider method init.

@Before
public void init() throws Exception {
    nodeManager = new MockNodeManager(true, 10);
    final OzoneConfiguration conf = SCMTestUtils.getConf();
    testDir = GenericTestUtils.getTestDir(TestContainerManagerImpl.class.getSimpleName() + UUID.randomUUID());
    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, testDir.getAbsolutePath());
    dbStore = DBStoreBuilder.createDBStore(conf, new SCMDBDefinition());
    SCMHAManager scmhaManager = MockSCMHAManager.getInstance(true);
    stateManager = PipelineStateManagerImpl.newBuilder().setPipelineStore(SCMDBDefinition.PIPELINES.getTable(dbStore)).setRatisServer(scmhaManager.getRatisServer()).setNodeManager(nodeManager).setSCMDBTransactionBuffer(scmhaManager.getDBTransactionBuffer()).build();
    provider = new SimplePipelineProvider(nodeManager, stateManager);
}
Also used : MockSCMHAManager(org.apache.hadoop.hdds.scm.ha.MockSCMHAManager) SCMHAManager(org.apache.hadoop.hdds.scm.ha.SCMHAManager) SCMDBDefinition(org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) TestContainerManagerImpl(org.apache.hadoop.hdds.scm.container.TestContainerManagerImpl) MockNodeManager(org.apache.hadoop.hdds.scm.container.MockNodeManager) Before(org.junit.Before)

Example 7 with SCMHAManager

use of org.apache.hadoop.hdds.scm.ha.SCMHAManager in project ozone by apache.

the class TestReconContainerManager method testAddNewOpenContainer.

@Test
public void testAddNewOpenContainer() throws IOException {
    ContainerWithPipeline containerWithPipeline = getTestContainer(LifeCycleState.OPEN);
    ContainerID containerID = containerWithPipeline.getContainerInfo().containerID();
    ContainerInfo containerInfo = containerWithPipeline.getContainerInfo();
    ReconContainerManager containerManager = getContainerManager();
    assertFalse(containerManager.containerExist(containerID));
    assertFalse(getContainerTable().isExist(containerID));
    containerManager.addNewContainer(containerWithPipeline);
    assertTrue(containerManager.containerExist(containerID));
    List<ContainerInfo> containers = containerManager.getContainers(LifeCycleState.OPEN);
    assertEquals(1, containers.size());
    assertEquals(containerInfo, containers.get(0));
    NavigableSet<ContainerID> containersInPipeline = getPipelineManager().getContainersInPipeline(containerWithPipeline.getPipeline().getId());
    assertEquals(1, containersInPipeline.size());
    assertEquals(containerID, containersInPipeline.first());
    // Verify container DB.
    SCMHAManager scmhaManager = containerManager.getSCMHAManager();
    scmhaManager.getDBTransactionBuffer().close();
    assertTrue(getContainerTable().isExist(containerID));
}
Also used : SCMHAManager(org.apache.hadoop.hdds.scm.ha.SCMHAManager) ContainerID(org.apache.hadoop.hdds.scm.container.ContainerID) ContainerInfo(org.apache.hadoop.hdds.scm.container.ContainerInfo) ContainerWithPipeline(org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline) Test(org.junit.Test)

Example 8 with SCMHAManager

use of org.apache.hadoop.hdds.scm.ha.SCMHAManager in project ozone by apache.

the class TestReplicationManager method createReplicationManager.

private void createReplicationManager(ReplicationManagerConfiguration rmConf) throws InterruptedException, IOException {
    OzoneConfiguration config = new OzoneConfiguration();
    testDir = GenericTestUtils.getTestDir(TestContainerManagerImpl.class.getSimpleName());
    config.set(HddsConfigKeys.OZONE_METADATA_DIRS, testDir.getAbsolutePath());
    config.setTimeDuration(HddsConfigKeys.HDDS_SCM_WAIT_TIME_AFTER_SAFE_MODE_EXIT, 0, TimeUnit.SECONDS);
    config.setFromObject(rmConf);
    SCMHAManager scmHAManager = MockSCMHAManager.getInstance(true, new SCMDBTransactionBufferImpl());
    dbStore = DBStoreBuilder.createDBStore(config, new SCMDBDefinition());
    replicationManager = new ReplicationManager(config, containerManager, containerPlacementPolicy, eventQueue, SCMContext.emptyContext(), serviceManager, nodeManager, clock, scmHAManager, SCMDBDefinition.MOVE.getTable(dbStore));
    serviceManager.notifyStatusChanged();
    scmLogs.clearOutput();
    Thread.sleep(100L);
}
Also used : SCMHAManager(org.apache.hadoop.hdds.scm.ha.SCMHAManager) MockSCMHAManager(org.apache.hadoop.hdds.scm.ha.MockSCMHAManager) SCMDBDefinition(org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition) SCMDBTransactionBufferImpl(org.apache.hadoop.hdds.scm.metadata.SCMDBTransactionBufferImpl) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration)

Aggregations

SCMHAManager (org.apache.hadoop.hdds.scm.ha.SCMHAManager)8 MockSCMHAManager (org.apache.hadoop.hdds.scm.ha.MockSCMHAManager)6 SCMDBDefinition (org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition)5 OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)4 MockNodeManager (org.apache.hadoop.hdds.scm.container.MockNodeManager)4 Test (org.junit.Test)4 TestContainerManagerImpl (org.apache.hadoop.hdds.scm.container.TestContainerManagerImpl)3 Before (org.junit.Before)3 IOException (java.io.IOException)2 HddsProtos (org.apache.hadoop.hdds.protocol.proto.HddsProtos)2 Longs (com.google.common.primitives.Longs)1 File (java.io.File)1 Instant (java.time.Instant)1 ZoneId (java.time.ZoneId)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1