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);
}
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));
}
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);
}
Aggregations