Search in sources :

Example 1 with SCMStorageConfig

use of org.apache.hadoop.hdds.scm.server.SCMStorageConfig in project ozone by apache.

the class TestStorageContainerManagerHA method testBootStrapSCM.

@Test
public void testBootStrapSCM() throws Exception {
    StorageContainerManager scm2 = cluster.getStorageContainerManagers().get(1);
    OzoneConfiguration conf2 = scm2.getConfiguration();
    boolean isDeleted = scm2.getScmStorageConfig().getVersionFile().delete();
    Assert.assertTrue(isDeleted);
    final SCMStorageConfig scmStorageConfig = new SCMStorageConfig(conf2);
    scmStorageConfig.setClusterId(UUID.randomUUID().toString());
    scmStorageConfig.getCurrentDir().delete();
    scmStorageConfig.initialize();
    conf2.setBoolean(ScmConfigKeys.OZONE_SCM_SKIP_BOOTSTRAP_VALIDATION_KEY, false);
    Assert.assertFalse(StorageContainerManager.scmBootstrap(conf2));
    conf2.setBoolean(ScmConfigKeys.OZONE_SCM_SKIP_BOOTSTRAP_VALIDATION_KEY, true);
    Assert.assertTrue(StorageContainerManager.scmBootstrap(conf2));
}
Also used : StorageContainerManager(org.apache.hadoop.hdds.scm.server.StorageContainerManager) SCMStorageConfig(org.apache.hadoop.hdds.scm.server.SCMStorageConfig) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) Test(org.junit.Test)

Example 2 with SCMStorageConfig

use of org.apache.hadoop.hdds.scm.server.SCMStorageConfig in project ozone by apache.

the class TestStorageContainerManager method testSCMInitializationWithHAEnabled.

@Test
public void testSCMInitializationWithHAEnabled() throws Exception {
    OzoneConfiguration conf = new OzoneConfiguration();
    conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, true);
    conf.set(ScmConfigKeys.OZONE_SCM_PIPELINE_CREATION_INTERVAL, "10s");
    final String path = GenericTestUtils.getTempPath(UUID.randomUUID().toString());
    Path scmPath = Paths.get(path, "scm-meta");
    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, scmPath.toString());
    final UUID clusterId = UUID.randomUUID();
    // This will initialize SCM
    StorageContainerManager.scmInit(conf, clusterId.toString());
    SCMStorageConfig scmStore = new SCMStorageConfig(conf);
    Assert.assertTrue(scmStore.isSCMHAEnabled());
    validateRatisGroupExists(conf, clusterId.toString());
}
Also used : Path(java.nio.file.Path) SCMStorageConfig(org.apache.hadoop.hdds.scm.server.SCMStorageConfig) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) UUID(java.util.UUID) Test(org.junit.Test)

Example 3 with SCMStorageConfig

use of org.apache.hadoop.hdds.scm.server.SCMStorageConfig in project ozone by apache.

the class TestStorageContainerManager method testSCMReinitializationWithHAUpgrade.

@Test
public void testSCMReinitializationWithHAUpgrade() throws Exception {
    OzoneConfiguration conf = new OzoneConfiguration();
    conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, false);
    final String path = GenericTestUtils.getTempPath(UUID.randomUUID().toString());
    Path scmPath = Paths.get(path, "scm-meta");
    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, scmPath.toString());
    // This will set the cluster id in the version file
    final UUID clusterId = UUID.randomUUID();
    // This will initialize SCM
    StorageContainerManager.scmInit(conf, clusterId.toString());
    SCMStorageConfig scmStore = new SCMStorageConfig(conf);
    Assert.assertEquals(clusterId.toString(), scmStore.getClusterID());
    Assert.assertFalse(scmStore.isSCMHAEnabled());
    conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, true);
    StorageContainerManager.scmInit(conf, clusterId.toString());
    scmStore = new SCMStorageConfig(conf);
    Assert.assertTrue(scmStore.isSCMHAEnabled());
    validateRatisGroupExists(conf, clusterId.toString());
}
Also used : Path(java.nio.file.Path) SCMStorageConfig(org.apache.hadoop.hdds.scm.server.SCMStorageConfig) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) UUID(java.util.UUID) Test(org.junit.Test)

Example 4 with SCMStorageConfig

use of org.apache.hadoop.hdds.scm.server.SCMStorageConfig in project ozone by apache.

the class TestSCMNodeManager method testProcessLayoutVersionLowerMlv.

@Test
public void testProcessLayoutVersionLowerMlv() throws IOException {
    OzoneConfiguration conf = new OzoneConfiguration();
    SCMStorageConfig scmStorageConfig = mock(SCMStorageConfig.class);
    when(scmStorageConfig.getClusterID()).thenReturn("xyz111");
    EventPublisher eventPublisher = mock(EventPublisher.class);
    HDDSLayoutVersionManager lvm = new HDDSLayoutVersionManager(scmStorageConfig.getLayoutVersion());
    SCMNodeManager nodeManager = new SCMNodeManager(conf, scmStorageConfig, eventPublisher, new NetworkTopologyImpl(conf), SCMContext.emptyContext(), lvm);
    DatanodeDetails node1 = HddsTestUtils.createRandomDatanodeAndRegister(nodeManager);
    verify(eventPublisher, times(1)).fireEvent(NEW_NODE, node1);
    int scmMlv = nodeManager.getLayoutVersionManager().getMetadataLayoutVersion();
    nodeManager.processLayoutVersionReport(node1, LayoutVersionProto.newBuilder().setMetadataLayoutVersion(scmMlv - 1).setSoftwareLayoutVersion(scmMlv).build());
    ArgumentCaptor<CommandForDatanode> captor = ArgumentCaptor.forClass(CommandForDatanode.class);
    verify(eventPublisher, times(1)).fireEvent(Mockito.eq(DATANODE_COMMAND), captor.capture());
    assertTrue(captor.getValue().getDatanodeId().equals(node1.getUuid()));
    assertTrue(captor.getValue().getCommand().getType().equals(finalizeNewLayoutVersionCommand));
}
Also used : NetworkTopologyImpl(org.apache.hadoop.hdds.scm.net.NetworkTopologyImpl) CommandForDatanode(org.apache.hadoop.ozone.protocol.commands.CommandForDatanode) EventPublisher(org.apache.hadoop.hdds.server.events.EventPublisher) SCMStorageConfig(org.apache.hadoop.hdds.scm.server.SCMStorageConfig) MockDatanodeDetails.randomDatanodeDetails(org.apache.hadoop.hdds.protocol.MockDatanodeDetails.randomDatanodeDetails) MockDatanodeDetails(org.apache.hadoop.hdds.protocol.MockDatanodeDetails) MockDatanodeDetails.createDatanodeDetails(org.apache.hadoop.hdds.protocol.MockDatanodeDetails.createDatanodeDetails) DatanodeDetails(org.apache.hadoop.hdds.protocol.DatanodeDetails) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) HDDSLayoutVersionManager(org.apache.hadoop.hdds.upgrade.HDDSLayoutVersionManager) Test(org.junit.Test)

Example 5 with SCMStorageConfig

use of org.apache.hadoop.hdds.scm.server.SCMStorageConfig in project ozone by apache.

the class TestCRLStatusReportHandler method init.

@Before
public void init() throws IOException {
    OzoneConfiguration config = new OzoneConfiguration();
    config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempDir.newFolder().getAbsolutePath());
    config.setBoolean(OZONE_SECURITY_ENABLED_KEY, true);
    SCMStorageConfig storageConfig = Mockito.mock(SCMStorageConfig.class);
    Mockito.when(storageConfig.getClusterID()).thenReturn("cluster1");
    scmMetadataStore = new SCMMetadataStoreImpl(config);
    certificateStore = new SCMCertStore.Builder().setRatisServer(null).setMetadaStore(scmMetadataStore).build();
    crlStatusReportHandler = new CRLStatusReportHandler(certificateStore, config);
}
Also used : SCMMetadataStoreImpl(org.apache.hadoop.hdds.scm.metadata.SCMMetadataStoreImpl) SCMStorageConfig(org.apache.hadoop.hdds.scm.server.SCMStorageConfig) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) Before(org.junit.Before)

Aggregations

SCMStorageConfig (org.apache.hadoop.hdds.scm.server.SCMStorageConfig)16 OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)13 Path (java.nio.file.Path)9 Test (org.junit.Test)9 HDDSLayoutVersionManager (org.apache.hadoop.hdds.upgrade.HDDSLayoutVersionManager)6 NetworkTopologyImpl (org.apache.hadoop.hdds.scm.net.NetworkTopologyImpl)5 EventQueue (org.apache.hadoop.hdds.server.events.EventQueue)5 UUID (java.util.UUID)4 NetworkTopology (org.apache.hadoop.hdds.scm.net.NetworkTopology)3 SCMNodeManager (org.apache.hadoop.hdds.scm.node.SCMNodeManager)3 EventPublisher (org.apache.hadoop.hdds.server.events.EventPublisher)3 Before (org.junit.Before)3 File (java.io.File)2 DatanodeDetails (org.apache.hadoop.hdds.protocol.DatanodeDetails)2 MockDatanodeDetails.randomDatanodeDetails (org.apache.hadoop.hdds.protocol.MockDatanodeDetails.randomDatanodeDetails)2 StorageContainerManager (org.apache.hadoop.hdds.scm.server.StorageContainerManager)2 IOException (java.io.IOException)1 MockDatanodeDetails (org.apache.hadoop.hdds.protocol.MockDatanodeDetails)1 MockDatanodeDetails.createDatanodeDetails (org.apache.hadoop.hdds.protocol.MockDatanodeDetails.createDatanodeDetails)1 HddsProtos (org.apache.hadoop.hdds.protocol.proto.HddsProtos)1