Search in sources :

Example 1 with PrepareBulkLoadResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadResponse 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)

Example 2 with PrepareBulkLoadResponse

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

the class RSRpcServices method prepareBulkLoad.

@Override
public PrepareBulkLoadResponse prepareBulkLoad(RpcController controller, PrepareBulkLoadRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        HRegion region = getRegion(request.getRegion());
        String bulkToken = server.getSecureBulkLoadManager().prepareBulkLoad(region, request);
        PrepareBulkLoadResponse.Builder builder = PrepareBulkLoadResponse.newBuilder();
        builder.setBulkToken(bulkToken);
        return builder.build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) UncheckedIOException(java.io.UncheckedIOException) PrepareBulkLoadResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadResponse)

Aggregations

IOException (java.io.IOException)2 PrepareBulkLoadResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadResponse)2 UncheckedIOException (java.io.UncheckedIOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)1 PrepareBulkLoadRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadRequest)1 RegionSpecifier (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)1 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1