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