use of org.apache.hadoop.ozone.container.replication.SimpleContainerDownloader in project ozone by apache.
the class TestDatanodeUpgradeToScmHA method importContainer.
/**
* Imports the container found in {@code source} to the datanode with the ID
* {@code containerID}.
*/
public void importContainer(long containerID, File source) throws Exception {
DownloadAndImportReplicator replicator = new DownloadAndImportReplicator(dsm.getContainer().getContainerSet(), dsm.getContainer().getController(), new SimpleContainerDownloader(conf, null), new TarContainerPacker());
File tempFile = tempFolder.newFile();
Files.copy(source.toPath(), tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
replicator.importContainer(containerID, tempFile.toPath());
}
use of org.apache.hadoop.ozone.container.replication.SimpleContainerDownloader in project ozone by apache.
the class ClosedContainerReplicator method initializeReplicationSupervisor.
@NotNull
private void initializeReplicationSupervisor(ConfigurationSource conf) throws IOException {
String fakeDatanodeUuid = datanode;
if (fakeDatanodeUuid.isEmpty()) {
fakeDatanodeUuid = UUID.randomUUID().toString();
}
ContainerSet containerSet = new ContainerSet();
ContainerMetrics metrics = ContainerMetrics.create(conf);
MutableVolumeSet volumeSet = new MutableVolumeSet(fakeDatanodeUuid, conf, null, StorageVolume.VolumeType.DATA_VOLUME, null);
Map<ContainerType, Handler> handlers = new HashMap<>();
for (ContainerType containerType : ContainerType.values()) {
final Handler handler = Handler.getHandlerForContainerType(containerType, conf, fakeDatanodeUuid, containerSet, volumeSet, metrics, containerReplicaProto -> {
});
handler.setClusterID(UUID.randomUUID().toString());
handlers.put(containerType, handler);
}
ContainerController controller = new ContainerController(containerSet, handlers);
ContainerReplicator replicator = new DownloadAndImportReplicator(containerSet, controller, new SimpleContainerDownloader(conf, null), new TarContainerPacker());
supervisor = new ReplicationSupervisor(containerSet, replicator, 10);
}
Aggregations