Class MultiRowMutationEndpoint

java.lang.Object
org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService
org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint
All Implemented Interfaces:
Coprocessor, RegionCoprocessor, org.apache.hbase.thirdparty.com.google.protobuf.Service

@LimitedPrivate("Coprocesssor") @Evolving public class MultiRowMutationEndpoint extends org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService implements RegionCoprocessor
This class implements atomic multi row transactions using HRegion.mutateRowsWithLocks(Collection, Collection, long, long) and Coprocessor endpoints. We can also specify some conditions to perform conditional update. Defines a protocol to perform multi row transactions. See MultiRowMutationEndpoint for the implementation.
See HRegion.mutateRowsWithLocks(Collection, Collection, long, long) for details and limitations.
Example: Put p = new Put(row1); Delete d = new Delete(row2); Increment i = new Increment(row3); Append a = new Append(row4); ... Mutate m1 = ProtobufUtil.toMutate(MutateType.PUT, p); Mutate m2 = ProtobufUtil.toMutate(MutateType.DELETE, d); Mutate m3 = ProtobufUtil.toMutate(MutateType.INCREMENT, i); Mutate m4 = ProtobufUtil.toMutate(MutateType.Append, a); MutateRowsRequest.Builder mrmBuilder = MutateRowsRequest.newBuilder(); mrmBuilder.addMutationRequest(m1); mrmBuilder.addMutationRequest(m2); mrmBuilder.addMutationRequest(m3); mrmBuilder.addMutationRequest(m4); // We can also specify conditions to preform conditional update mrmBuilder.addCondition(ProtobufUtil.toCondition(row, FAMILY, QUALIFIER, CompareOperator.EQUAL, value, TimeRange.allTime())); CoprocessorRpcChannel channel = t.coprocessorService(ROW); MultiRowMutationService.BlockingInterface service = MultiRowMutationService.newBlockingStub(channel); MutateRowsRequest mrm = mrmBuilder.build(); MutateRowsResponse response = service.mutateRows(null, mrm); // We can get the result of the conditional update boolean processed = response.getProcessed();
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService

    org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService.BlockingInterface, org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService.Interface, org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService.Stub

    Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.Coprocessor

    Coprocessor.State
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private static final org.slf4j.Logger
     

    Fields inherited from interface org.apache.hadoop.hbase.Coprocessor

    PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    checkFamily(Region region, byte[] family)
     
    Iterable<org.apache.hbase.thirdparty.com.google.protobuf.Service>
    Coprocessor endpoints providing protobuf services should override this method.
    private boolean
    matches(CompareOperator op, int compareResult)
     
    private boolean
    matches(Region region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Condition condition)
     
    void
    mutateRows(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MutateRowsRequest request, org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MutateRowsResponse> done)
     
    void
    Stores a reference to the coprocessor environment provided by the RegionCoprocessorHost from the region where this coprocessor is loaded.
    void
    Called by the CoprocessorEnvironment during it's own shutdown to stop the coprocessor.

    Methods inherited from class org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService

    callMethod, getDescriptor, getDescriptorForType, getRequestPrototype, getResponsePrototype, newBlockingStub, newReflectiveBlockingService, newReflectiveService, newStub

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.hadoop.hbase.coprocessor.RegionCoprocessor

    getBulkLoadObserver, getEndpointObserver, getRegionObserver
  • Field Details

  • Constructor Details

  • Method Details

    • mutateRows

      public void mutateRows(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MutateRowsRequest request, org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MutateRowsResponse> done)
      Specified by:
      mutateRows in class org.apache.hadoop.hbase.shaded.protobuf.generated.MultiRowMutationProtos.MultiRowMutationService
    • matches

      private boolean matches(Region region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Condition condition) throws IOException
      Throws:
      IOException
    • checkFamily

      private void checkFamily(Region region, byte[] family) throws NoSuchColumnFamilyException
      Throws:
      NoSuchColumnFamilyException
    • matches

      private boolean matches(CompareOperator op, int compareResult)
    • getServices

      public Iterable<org.apache.hbase.thirdparty.com.google.protobuf.Service> getServices()
      Description copied from interface: Coprocessor
      Coprocessor endpoints providing protobuf services should override this method.
      Specified by:
      getServices in interface Coprocessor
      Returns:
      Iterable of Services or empty collection. Implementations should never return null.
    • start

      public void start(CoprocessorEnvironment env) throws IOException
      Stores a reference to the coprocessor environment provided by the RegionCoprocessorHost from the region where this coprocessor is loaded. Since this is a coprocessor endpoint, it always expects to be loaded on a table region, so always expects this to be an instance of RegionCoprocessorEnvironment.
      Specified by:
      start in interface Coprocessor
      Parameters:
      env - the environment provided by the coprocessor host
      Throws:
      IOException - if the provided environment is not an instance of RegionCoprocessorEnvironment
    • stop

      public void stop(CoprocessorEnvironment env) throws IOException
      Description copied from interface: Coprocessor
      Called by the CoprocessorEnvironment during it's own shutdown to stop the coprocessor.
      Specified by:
      stop in interface Coprocessor
      Throws:
      IOException