Search in sources :

Example 1 with BlockManager

use of org.apache.hadoop.ozone.container.keyvalue.interfaces.BlockManager 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)

Aggregations

File (java.io.File)1 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 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 MutableVolumeSet (org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet)1 RoundRobinVolumeChoosingPolicy (org.apache.hadoop.ozone.container.common.volume.RoundRobinVolumeChoosingPolicy)1 BlockManagerImpl (org.apache.hadoop.ozone.container.keyvalue.impl.BlockManagerImpl)1 BlockManager (org.apache.hadoop.ozone.container.keyvalue.interfaces.BlockManager)1