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