hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vikash Agarwal <vikash.nit...@gmail.com>
Subject Re: How to get bulk delete [Hbase1.2.0]
Date Tue, 13 Mar 2018 09:44:52 GMT
Hi All,

Just to make it clear , I am using Hbase 1.2.0 and that doesn't have bulk
delete end point.

I tried the code below:

private long invokeBulkDeleteProtocol(byte[] tableName, final Scan
scan, final int rowBatchSize,
      final byte deleteType, final Long timeStamp) throws Throwable {
     HTable ht = new HTable(TEST_UTIL.getConfiguration(), tableName);
     long noOfDeletedRows = 0L;
     Batch.Call<BulkDeleteProtocol, BulkDeleteResponse> callable =
new Batch.Call<BulkDeleteProtocol, BulkDeleteResponse>() {
      public BulkDeleteResponse call(BulkDeleteProtocol instance)
throws IOException {
        return instance.delete(scan, deleteType, timeStamp, rowBatchSize);
      }
    };
    Map<byte[], BulkDeleteResponse> result =
ht.coprocessorExec(BulkDeleteProtocol.class,
        scan.getStartRow(), scan.getStopRow(), callable);
    for (BulkDeleteResponse response : result.values()) {
      noOfDeletedRows += response.getRowsDeleted();
    }
    return noOfDeletedRows;
}

But none of the above Classes available in Habse 1.2.0

Can I get a similar example as above to be used in hbase 1.2.0 and above.







On 5 March 2018 at 14:33, Anoop John <anoop.hbase@gmail.com> wrote:

> BulkDeleteEP allows to pass a Scan .  What all rows this Scan returns
> all can be deleted.  So you can create an appropriate Scan to fetch
> all rows with a common prefix.   Pls try once.
>
> -Anoop-
>
> On Sat, Mar 3, 2018 at 2:49 AM, Ted Yu <yuzhihong@gmail.com> wrote:
> > For #2, BulkDeleteEndpoint still exists - in hbase-examples branch.
> >
> > ./hbase-examples/src/main/java/org/apache/hadoop/hbase/
> coprocessor/example/BulkDeleteEndpoint.java
> >
> > On Thu, Mar 1, 2018 at 10:02 PM, Vikash Agarwal <vikash.nitdgp@gmail.com
> >
> > wrote:
> >
> >> Hi Team,
> >>
> >> I am looking for  a bulk delete in Hbase.
> >>
> >> I am looking here for two things:
> >>
> >> 1. In case I provide a Row key Prefix , Is it possible to delete all the
> >> rows with that prefix.
> >>
> >> 2. In case Where we can scan and delete and the server End. Something
> like
> >> BulkDeleteEndpoint which uses to exist in old hbase version 0.94.
> >>
> >>
> >>
> >> --
> >> Vikash Agarwal
> >>
>



-- 
Vikash Agarwal

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message