use of org.apache.hadoop.hdds.scm.XceiverClientManager in project ozone by apache.
the class ContainerOperationClient method createContainer.
@Override
public ContainerWithPipeline createContainer(HddsProtos.ReplicationType type, HddsProtos.ReplicationFactor factor, String owner) throws IOException {
XceiverClientSpi client = null;
XceiverClientManager clientManager = getXceiverClientManager();
try {
// allocate container on SCM.
ContainerWithPipeline containerWithPipeline = storageContainerLocationClient.allocateContainer(type, factor, owner);
Pipeline pipeline = containerWithPipeline.getPipeline();
// connect to pipeline leader and allocate container on leader datanode.
client = clientManager.acquireClient(pipeline);
createContainer(client, containerWithPipeline.getContainerInfo().getContainerID());
return containerWithPipeline;
} finally {
if (client != null) {
clientManager.releaseClient(client, false);
}
}
}
use of org.apache.hadoop.hdds.scm.XceiverClientManager in project ozone by apache.
the class ContainerOperationClient method createContainer.
@Override
public ContainerWithPipeline createContainer(String owner) throws IOException {
XceiverClientSpi client = null;
XceiverClientManager clientManager = getXceiverClientManager();
try {
ContainerWithPipeline containerWithPipeline = storageContainerLocationClient.allocateContainer(replicationType, replicationFactor, owner);
Pipeline pipeline = containerWithPipeline.getPipeline();
client = clientManager.acquireClient(pipeline);
Preconditions.checkState(pipeline.isOpen(), "Unexpected state=%s for pipeline=%s, expected state=%s", pipeline.getPipelineState(), pipeline.getId(), Pipeline.PipelineState.OPEN);
createContainer(client, containerWithPipeline.getContainerInfo().getContainerID());
return containerWithPipeline;
} finally {
if (client != null) {
clientManager.releaseClient(client, false);
}
}
}
use of org.apache.hadoop.hdds.scm.XceiverClientManager in project ozone by apache.
the class TestAllocateContainer method init.
@BeforeClass
public static void init() throws Exception {
conf = new OzoneConfiguration();
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(3).build();
cluster.waitForClusterToBeReady();
storageContainerLocationClient = cluster.getStorageContainerLocationClient();
xceiverClientManager = new XceiverClientManager(conf);
}
use of org.apache.hadoop.hdds.scm.XceiverClientManager in project ozone by apache.
the class TestGetCommittedBlockLengthAndPutKey method init.
@BeforeClass
public static void init() throws Exception {
ozoneConfig = new OzoneConfiguration();
ozoneConfig.setClass(ScmConfigKeys.OZONE_SCM_CONTAINER_PLACEMENT_IMPL_KEY, SCMContainerPlacementCapacity.class, PlacementPolicy.class);
cluster = MiniOzoneCluster.newBuilder(ozoneConfig).setNumDatanodes(3).build();
cluster.waitForClusterToBeReady();
storageContainerLocationClient = cluster.getStorageContainerLocationClient();
xceiverClientManager = new XceiverClientManager(ozoneConfig);
}
use of org.apache.hadoop.hdds.scm.XceiverClientManager in project ozone by apache.
the class TestBlockOutputStreamCorrectness method createBlockOutputStream.
private BlockOutputStream createBlockOutputStream(BufferPool bufferPool) throws IOException {
final Pipeline pipeline = MockPipeline.createRatisPipeline();
final XceiverClientManager xcm = Mockito.mock(XceiverClientManager.class);
Mockito.when(xcm.acquireClient(Mockito.any())).thenReturn(new MockXceiverClientSpi(pipeline));
OzoneClientConfig config = new OzoneClientConfig();
config.setStreamBufferSize(4 * 1024 * 1024);
config.setStreamBufferMaxSize(32 * 1024 * 1024);
config.setStreamBufferFlushDelay(true);
config.setStreamBufferFlushSize(16 * 1024 * 1024);
config.setChecksumType(ChecksumType.NONE);
config.setBytesPerChecksum(256 * 1024);
BlockOutputStream outputStream = new RatisBlockOutputStream(new BlockID(1L, 1L), xcm, pipeline, bufferPool, config, null);
return outputStream;
}
Aggregations