Search in sources :

Example 16 with RpcController

use of org.apache.hbase.thirdparty.com.google.protobuf.RpcController in project hbase by apache.

the class TestMultiLogThreshold method sendMultiRequest.

/**
 * Sends a multi request with a certain amount of rows, will populate Multi command with either
 * "rows" number of RegionActions with one Action each or one RegionAction with "rows" number of
 * Actions
 */
private void sendMultiRequest(int rows, ActionType actionType) throws ServiceException, IOException {
    RpcController rpcc = Mockito.mock(HBaseRpcController.class);
    MultiRequest.Builder builder = MultiRequest.newBuilder();
    int numRAs = 1;
    int numAs = 1;
    switch(actionType) {
        case REGION_ACTIONS:
            numRAs = rows;
            break;
        case ACTIONS:
            numAs = rows;
            break;
    }
    for (int i = 0; i < numRAs; i++) {
        RegionAction.Builder rab = RegionAction.newBuilder();
        rab.setRegion(RequestConverter.buildRegionSpecifier(HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME, Bytes.toBytes("someStuff" + i)));
        for (int j = 0; j < numAs; j++) {
            Action.Builder ab = Action.newBuilder();
            rab.addAction(ab.build());
        }
        builder.addRegionAction(rab.build());
    }
    services = new RSRpcServices(rs);
    services.multi(rpcc, builder.build());
}
Also used : RpcController(org.apache.hbase.thirdparty.com.google.protobuf.RpcController) HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) RegionAction(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.RegionAction) Action(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Action) MultiRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MultiRequest) RegionAction(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.RegionAction)

Aggregations

RpcController (org.apache.hbase.thirdparty.com.google.protobuf.RpcController)16 IOException (java.io.IOException)15 CoprocessorRpcUtils (org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils)14 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)12 List (java.util.List)8 Pair (org.apache.hadoop.hbase.util.Pair)8 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 InvocationTargetException (java.lang.reflect.InvocationTargetException)6 Method (java.lang.reflect.Method)6 Collections (java.util.Collections)6 Configuration (org.apache.hadoop.conf.Configuration)6 InetAddress (java.net.InetAddress)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 Entry (java.util.Map.Entry)5 Set (java.util.Set)5 AggregateRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateRequest)5 AggregateResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateResponse)5 AggregateService (org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateService)5