Search in sources :

Example 1 with BlockManagerImpl

use of org.apache.hadoop.ozone.container.keyvalue.impl.BlockManagerImpl in project ozone by apache.

the class GeneratorDatanode method call.

@Override
public Void call() throws Exception {
    init();
    config = createOzoneConfiguration();
    BlockManager blockManager = new BlockManagerImpl(config);
    chunkManager = ChunkManagerFactory.createChunkManager(config, blockManager, null);
    final Collection<String> storageDirs = HddsServerUtil.getDatanodeStorageDirs(config);
    String firstStorageDir = StorageLocation.parse(storageDirs.iterator().next()).getUri().getPath();
    final Path hddsDir = Paths.get(firstStorageDir, "hdds");
    if (!Files.exists(hddsDir)) {
        throw new NoSuchFileException(hddsDir + " doesn't exist. Please start a real cluster to initialize the " + "VERSION descriptors, and re-start this generator after the files" + " are created (but after cluster is stopped).");
    }
    scmId = getScmIdFromStoragePath(hddsDir);
    final File versionFile = new File(firstStorageDir, "hdds/VERSION");
    Properties props = DatanodeVersionFile.readFrom(versionFile);
    if (props.isEmpty()) {
        throw new InconsistentStorageStateException("Version file " + versionFile + " is missing");
    }
    String clusterId = HddsVolumeUtil.getProperty(props, OzoneConsts.CLUSTER_ID, versionFile);
    datanodeId = HddsVolumeUtil.getProperty(props, OzoneConsts.DATANODE_UUID, versionFile);
    volumeSet = new MutableVolumeSet(datanodeId, clusterId, config, null, StorageVolume.VolumeType.DATA_VOLUME, null);
    volumeChoosingPolicy = new RoundRobinVolumeChoosingPolicy();
    final OzoneClientConfig ozoneClientConfig = config.getObject(OzoneClientConfig.class);
    checksum = new Checksum(ozoneClientConfig.getChecksumType(), ozoneClientConfig.getBytesPerChecksum());
    timer = getMetrics().timer("datanode-generator");
    runTests(this::generateData);
    return null;
}
Also used : Path(java.nio.file.Path) RoundRobinVolumeChoosingPolicy(org.apache.hadoop.ozone.container.common.volume.RoundRobinVolumeChoosingPolicy) NoSuchFileException(java.nio.file.NoSuchFileException) OzoneClientConfig(org.apache.hadoop.hdds.scm.OzoneClientConfig) Properties(java.util.Properties) BlockManager(org.apache.hadoop.ozone.container.keyvalue.interfaces.BlockManager) Checksum(org.apache.hadoop.ozone.common.Checksum) MutableVolumeSet(org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet) DatanodeVersionFile(org.apache.hadoop.ozone.container.common.helpers.DatanodeVersionFile) File(java.io.File) BlockManagerImpl(org.apache.hadoop.ozone.container.keyvalue.impl.BlockManagerImpl) InconsistentStorageStateException(org.apache.hadoop.ozone.common.InconsistentStorageStateException)

Example 2 with BlockManagerImpl

use of org.apache.hadoop.ozone.container.keyvalue.impl.BlockManagerImpl in project ozone by apache.

the class TestContainerPersistence method setupPaths.

@Before
public void setupPaths() throws IOException {
    containerSet = new ContainerSet();
    volumeSet = new MutableVolumeSet(DATANODE_UUID, conf, null, StorageVolume.VolumeType.DATA_VOLUME, null);
    blockManager = new BlockManagerImpl(conf);
    chunkManager = ChunkManagerFactory.createChunkManager(conf, blockManager, null);
    for (String dir : conf.getStrings(ScmConfigKeys.HDDS_DATANODE_DIR_KEY)) {
        StorageLocation location = StorageLocation.parse(dir);
        FileUtils.forceMkdir(new File(location.getNormalizedUri()));
    }
}
Also used : MutableVolumeSet(org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet) StorageLocation(org.apache.hadoop.hdfs.server.datanode.StorageLocation) File(java.io.File) BlockManagerImpl(org.apache.hadoop.ozone.container.keyvalue.impl.BlockManagerImpl) Before(org.junit.Before)

Aggregations

File (java.io.File)2 MutableVolumeSet (org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet)2 BlockManagerImpl (org.apache.hadoop.ozone.container.keyvalue.impl.BlockManagerImpl)2 NoSuchFileException (java.nio.file.NoSuchFileException)1 Path (java.nio.file.Path)1 Properties (java.util.Properties)1 OzoneClientConfig (org.apache.hadoop.hdds.scm.OzoneClientConfig)1 StorageLocation (org.apache.hadoop.hdfs.server.datanode.StorageLocation)1 Checksum (org.apache.hadoop.ozone.common.Checksum)1 InconsistentStorageStateException (org.apache.hadoop.ozone.common.InconsistentStorageStateException)1 DatanodeVersionFile (org.apache.hadoop.ozone.container.common.helpers.DatanodeVersionFile)1 RoundRobinVolumeChoosingPolicy (org.apache.hadoop.ozone.container.common.volume.RoundRobinVolumeChoosingPolicy)1 BlockManager (org.apache.hadoop.ozone.container.keyvalue.interfaces.BlockManager)1 Before (org.junit.Before)1