Search in sources :

Example 1 with OpReplaceBlockProto

use of org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpReplaceBlockProto in project hadoop by apache.

the class Sender method replaceBlock.

@Override
public void replaceBlock(final ExtendedBlock blk, final StorageType storageType, final Token<BlockTokenIdentifier> blockToken, final String delHint, final DatanodeInfo source) throws IOException {
    OpReplaceBlockProto proto = OpReplaceBlockProto.newBuilder().setHeader(DataTransferProtoUtil.buildBaseHeader(blk, blockToken)).setStorageType(PBHelperClient.convertStorageType(storageType)).setDelHint(delHint).setSource(PBHelperClient.convertDatanodeInfo(source)).build();
    send(out, Op.REPLACE_BLOCK, proto);
}
Also used : OpReplaceBlockProto(org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpReplaceBlockProto)

Example 2 with OpReplaceBlockProto

use of org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpReplaceBlockProto in project hadoop by apache.

the class Receiver method opReplaceBlock.

/** Receive OP_REPLACE_BLOCK */
private void opReplaceBlock(DataInputStream in) throws IOException {
    OpReplaceBlockProto proto = OpReplaceBlockProto.parseFrom(vintPrefixed(in));
    TraceScope traceScope = continueTraceSpan(proto.getHeader(), proto.getClass().getSimpleName());
    try {
        replaceBlock(PBHelperClient.convert(proto.getHeader().getBlock()), PBHelperClient.convertStorageType(proto.getStorageType()), PBHelperClient.convert(proto.getHeader().getToken()), proto.getDelHint(), PBHelperClient.convert(proto.getSource()));
    } finally {
        if (traceScope != null)
            traceScope.close();
    }
}
Also used : OpReplaceBlockProto(org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpReplaceBlockProto) TraceScope(org.apache.htrace.core.TraceScope)

Aggregations

OpReplaceBlockProto (org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpReplaceBlockProto)2 TraceScope (org.apache.htrace.core.TraceScope)1