Search in sources :

Example 1 with CommitBlockSynchronizationRequestProto

use of org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CommitBlockSynchronizationRequestProto in project hadoop by apache.

the class DatanodeProtocolClientSideTranslatorPB method commitBlockSynchronization.

@Override
public void commitBlockSynchronization(ExtendedBlock block, long newgenerationstamp, long newlength, boolean closeFile, boolean deleteblock, DatanodeID[] newtargets, String[] newtargetstorages) throws IOException {
    CommitBlockSynchronizationRequestProto.Builder builder = CommitBlockSynchronizationRequestProto.newBuilder().setBlock(PBHelperClient.convert(block)).setNewGenStamp(newgenerationstamp).setNewLength(newlength).setCloseFile(closeFile).setDeleteBlock(deleteblock);
    for (int i = 0; i < newtargets.length; i++) {
        builder.addNewTaragets(PBHelperClient.convert(newtargets[i]));
        builder.addNewTargetStorages(newtargetstorages[i]);
    }
    CommitBlockSynchronizationRequestProto req = builder.build();
    try {
        rpcProxy.commitBlockSynchronization(NULL_CONTROLLER, req);
    } catch (ServiceException se) {
        throw ProtobufHelper.getRemoteException(se);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) CommitBlockSynchronizationRequestProto(org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CommitBlockSynchronizationRequestProto)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 CommitBlockSynchronizationRequestProto (org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CommitBlockSynchronizationRequestProto)1