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