You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Vikash Agarwal <vi...@gmail.com> on 2018/03/02 06:02:52 UTC

How to get bulk delete [Hbase1.2.0]

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

Re: How to get bulk delete [Hbase1.2.0]

Posted by Vikash Agarwal <vi...@gmail.com>.
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 <an...@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 <yu...@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

Re: How to get bulk delete [Hbase1.2.0]

Posted by Anoop John <an...@gmail.com>.
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 <yu...@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 <vi...@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
>>

Re: How to get bulk delete [Hbase1.2.0]

Posted by Ted Yu <yu...@gmail.com>.
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 <vi...@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
>