@InterfaceAudience.Private public class BulkDeleteEndpoint extends org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteService implements RegionCoprocessor
 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();
 }
 | Modifier and Type | Class and Description | 
|---|---|
| private static class  | BulkDeleteEndpoint.Column | 
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.StubCoprocessor.State| Modifier and Type | Field and Description | 
|---|---|
| private RegionCoprocessorEnvironment | env | 
| private static org.slf4j.Logger | LOG | 
| private static String | NO_OF_VERSIONS_TO_DELETE | 
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION| Constructor and Description | 
|---|
| BulkDeleteEndpoint() | 
| Modifier and Type | Method and 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> | getServices()Coprocessor endpoints providing protobuf services should override this method. | 
| void | start(CoprocessorEnvironment env)Called by the  CoprocessorEnvironmentduring it's own startup to initialize the
 coprocessor. | 
| void | stop(CoprocessorEnvironment env)Called by the  CoprocessorEnvironmentduring it's own shutdown to stop the
 coprocessor. | 
callMethod, getDescriptor, getDescriptorForType, getRequestPrototype, getResponsePrototype, newBlockingStub, newReflectiveBlockingService, newReflectiveService, newStubclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBulkLoadObserver, getEndpointObserver, getRegionObserverprivate static final String NO_OF_VERSIONS_TO_DELETE
private static final org.slf4j.Logger LOG
private RegionCoprocessorEnvironment env
public BulkDeleteEndpoint()
public Iterable<com.google.protobuf.Service> getServices()
CoprocessorgetServices in interface CoprocessorServices or empty collection. Implementations should never
 return null.public 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)
delete in class org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteServiceprivate Delete createDeleteMutation(List<Cell> deleteRow, org.apache.hadoop.hbase.coprocessor.example.generated.BulkDeleteProtos.BulkDeleteRequest.DeleteType deleteType, Long timestamp)
public void start(CoprocessorEnvironment env) throws IOException
CoprocessorCoprocessorEnvironment during it's own startup to initialize the
 coprocessor.start in interface CoprocessorIOExceptionpublic void stop(CoprocessorEnvironment env) throws IOException
CoprocessorCoprocessorEnvironment during it's own shutdown to stop the
 coprocessor.stop in interface CoprocessorIOExceptionCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.