org.apache.hadoop.hbase.coprocessor.example
Interface BulkDeleteProtocol
- All Superinterfaces:
- CoprocessorProtocol, VersionedProtocol
- All Known Implementing Classes:
- BulkDeleteEndpoint
public interface BulkDeleteProtocol
- extends CoprocessorProtocol
Defines a protocol to delete data in bulk based on a scan. The scan can be range scan or with
conditions(filters) etc.
Example:
Scan scan = new Scan();
// set scan properties(rowkey range, filters, timerange etc).
HTable ht = ...;
long noOfDeletedRows = 0L;
Batch.Call<BulkDeleteProtocol, BulkDeleteResponse> callable =
new Batch.Call<BulkDeleteProtocol, BulkDeleteResponse>() {
public BulkDeleteResponse call(BulkDeleteProtocol instance) throws IOException {
return instance.deleteRows(scan, BulkDeleteProtocol.DeleteType, timestamp, rowBatchSize);
}
};
Map<byte[], BulkDeleteResponse> result = ht.coprocessorExec(BulkDeleteProtocol.class,
scan.getStartRow(), scan.getStopRow(), callable);
for (BulkDeleteResponse response : result.values()) {
noOfDeletedRows = response.getRowsDeleted();
}
delete
BulkDeleteResponse delete(Scan scan,
byte deleteType,
Long timestamp,
int rowBatchSize)
- Parameters:
scan
- deleteType
- timestamp
- rowBatchSize
- The number of rows which need to be accumulated by scan and delete as one batch
- Returns:
Copyright © 2015 The Apache Software Foundation. All Rights Reserved.