Search in sources :

Example 1 with PrepareBulkLoadRequest

use of org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadRequest in project hbase by apache.

the class SecureBulkLoadClient method prepareBulkLoad.

public String prepareBulkLoad(final Connection conn) throws IOException {
    try {
        ClientServiceCallable<String> callable = new ClientServiceCallable<String>(conn, table.getName(), HConstants.EMPTY_START_ROW, this.rpcControllerFactory.newController()) {

            @Override
            protected String rpcCall() throws Exception {
                byte[] regionName = getLocation().getRegionInfo().getRegionName();
                RegionSpecifier region = RequestConverter.buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
                PrepareBulkLoadRequest request = PrepareBulkLoadRequest.newBuilder().setTableName(ProtobufUtil.toProtoTableName(table.getName())).setRegion(region).build();
                PrepareBulkLoadResponse response = getStub().prepareBulkLoad(null, request);
                return response.getBulkToken();
            }
        };
        return RpcRetryingCallerFactory.instantiate(conn.getConfiguration(), null).<String>newCaller().callWithRetries(callable, Integer.MAX_VALUE);
    } catch (Throwable throwable) {
        throw new IOException(throwable);
    }
}
Also used : PrepareBulkLoadRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadRequest) IOException(java.io.IOException) PrepareBulkLoadResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadResponse) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Aggregations

IOException (java.io.IOException)1 PrepareBulkLoadRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadRequest)1 PrepareBulkLoadResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadResponse)1 RegionSpecifier (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)1