Class BulkDeleteEndpoint

java.lang.Object
org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService
org.apache.hadoop.hbase.coprocessor.example.BulkDeleteEndpoint
All Implemented Interfaces:
com.google.protobuf.Service, Coprocessor, RegionCoprocessor

@Private public class BulkDeleteEndpoint extends org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService implements RegionCoprocessor
Defines a protocol to delete data in bulk based on a scan. The scan can be range scan or with conditions(filters) etc.This can be used to delete rows, column family(s), column qualifier(s) or version(s) of columns.When delete type is FAMILY or COLUMN, which all family(s) or column(s) getting deleted will be determined by the Scan. Scan need to select all the families/qualifiers which need to be deleted.When delete type is VERSION, Which column(s) and version(s) to be deleted will be determined by the Scan. Scan need to select all the qualifiers and its versions which needs to be deleted.When a timestamp is passed only one version at that timestamp will be deleted(even if Scan fetches many versions). When timestamp passed as null, all the versions which the Scan selects will get deleted.
Example:
 
 Scan scan = new Scan();
 // set scan properties(rowkey range, filters, timerange etc).
 HTable ht = ...;
 long noOfDeletedRows = 0L;
 Batch.Call<BulkDeleteService, BulkDeleteResponse> callable =
     new Batch.Call<BulkDeleteService, BulkDeleteResponse>() {
   ServerRpcController controller = new ServerRpcController();
   BlockingRpcCallback<BulkDeleteResponse> rpcCallback =
     new BlockingRpcCallback<BulkDeleteResponse>();

   public BulkDeleteResponse call(BulkDeleteService service) throws IOException {
     Builder builder = BulkDeleteRequest.newBuilder();
     builder.setScan(ProtobufUtil.toScan(scan));
     builder.setDeleteType(DeleteType.VERSION);
     builder.setRowBatchSize(rowBatchSize);
     // Set optional timestamp if needed
     builder.setTimestamp(timeStamp);
     service.delete(controller, builder.build(), rpcCallback);
     return rpcCallback.get();
   }
 };
 Map<byte[], BulkDeleteResponse> result = ht.coprocessorService(BulkDeleteService.class,
  scan.getStartRow(), scan.getStopRow(), callable);
 for (BulkDeleteResponse response : result.values()) {
   noOfDeletedRows += response.getRowsDeleted();
 }
 
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     

    Nested classes/interfaces inherited from class org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService

    org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService.BlockingInterface, org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService.Interface, org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService.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
     
    private static final String
     

    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 Delete
    createDeleteMutation(List<Cell> deleteRow, org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteRequest.DeleteType deleteType, Long timestamp)
     
    void
    delete(com.google.protobuf.RpcController controller, org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteRequest request, com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteResponse> done)
     
    Iterable<com.google.protobuf.Service>
    Coprocessor endpoints providing protobuf services should override this method.
    void
    Called by the CoprocessorEnvironment during it's own startup to initialize the coprocessor.
    void
    Called by the CoprocessorEnvironment during it's own shutdown to stop the coprocessor.

    Methods inherited from class org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService

    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