You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Jean-Marc Spaggiari <je...@spaggiari.org> on 2013/02/05 17:13:58 UTC

Empty a table

Hi,

Is there an easy way to empty a table but keep the regions? Truncate
will remove everything even the splitting. But I want to keep the
regions the way they are. I just want to clean them. Is there a simple
way to do that with the shell or something like that?

Thanks,

JM

Re: Empty a table

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Andrew,

Thanks for the idea. However, there is no real timing here. I have a
MR building this table, and each time I re-launch the MR, I need to
clean the table first. But I reallt would like to keep the way HBased
splitted it instead of having to do manual splits, or starting with
one region.

So I will wait for Kevin to complete
https://issues.apache.org/jira/browse/HBASE-5525 ;)

JM

2013/2/5, Andrew Purtell <ap...@apache.org>:
> If there is a time consideration here, perhaps you want to do this because
> the data isn't interesting after some time interval has elapsed but the
> keyspace for new entries will be similar -- then consider using TTLs. It's
> easy and they will do what you want, garbage collecting useless data while
> not changing region boundaries.
>
> On Tuesday, February 5, 2013, Jean-Marc Spaggiari wrote:
>
>> Nive to see that it's already in progress ;)
>>
>> Tian-Ying, thanks for the idea. I will most probably give it a try!
>>
>> JM
>>
>> 2013/2/5, Ted Yu <yuzhihong@gmail.com <javascript:;>>:
>> > Looks like a little polishing would make the tool available in 0.96 :-)
>> >
>> > On Tue, Feb 5, 2013 at 9:38 AM, Kevin O'dell
>> > <kevin.odell@cloudera.com <javascript:;>>wrote:
>> >
>> >> I am a bad person, but I have that JIRA in my name.  I need to make
>> >> the
>> >> patch pretty.
>> >>
>> >> https://issues.apache.org/jira/browse/HBASE-5525
>> >>
>> >> There is a patch there that works, it is just not pretty.
>> >>
>> >> On Tue, Feb 5, 2013 at 12:28 PM, Ted Yu
>> >> <yuzhihong@gmail.com<javascript:;>>
>> wrote:
>> >>
>> >> > To my knowledge there is no such tool.
>> >> >
>> >> > You can file a JIRA in case someone has bandwidth to work on such
>> tool.
>> >> >
>> >> > Thanks
>> >> >
>> >> > On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <
>> >> > jean-marc@spaggiari.org <javascript:;>
>> >> > > wrote:
>> >> >
>> >> > > Hi,
>> >> > >
>> >> > > Is there an easy way to empty a table but keep the regions?
>> >> > > Truncate
>> >> > > will remove everything even the splitting. But I want to keep the
>> >> > > regions the way they are. I just want to clean them. Is there a
>> >> > > simple
>> >> > > way to do that with the shell or something like that?
>> >> > >
>> >> > > Thanks,
>> >> > >
>> >> > > JM
>> >> > >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Kevin O'Dell
>> >> Customer Operations Engineer, Cloudera
>> >>
>> >
>>
>
>
> --
> Best regards,
>
>    - Andy
>
> Problems worthy of attack prove their worth by hitting back. - Piet Hein
> (via Tom White)
>

Re: Empty a table

Posted by ramkrishna vasudevan <ra...@gmail.com>.
I would think that the ideal suggested by Tianyang Chang is good.  Though
we may have to disable the table.

Regards
Ram

On Fri, Feb 8, 2013 at 12:46 AM, Michael Segel <mi...@hotmail.com>wrote:

> I think its more akin of the typical 'truncate' command.
>
> Actually, if someone wanted to extend HBase Shell, I would imagine a
> simple Ruby er JRuby script could do this? (You would want to disable the
> table first)
>
> Just a thought.
>
> On Feb 5, 2013, at 12:36 PM, Andrew Purtell <ap...@apache.org> wrote:
>
> > If there is a time consideration here, perhaps you want to do this
> because
> > the data isn't interesting after some time interval has elapsed but the
> > keyspace for new entries will be similar -- then consider using TTLs.
> It's
> > easy and they will do what you want, garbage collecting useless data
> while
> > not changing region boundaries.
> >
> > On Tuesday, February 5, 2013, Jean-Marc Spaggiari wrote:
> >
> >> Nive to see that it's already in progress ;)
> >>
> >> Tian-Ying, thanks for the idea. I will most probably give it a try!
> >>
> >> JM
> >>
> >> 2013/2/5, Ted Yu <yuzhihong@gmail.com <javascript:;>>:
> >>> Looks like a little polishing would make the tool available in 0.96 :-)
> >>>
> >>> On Tue, Feb 5, 2013 at 9:38 AM, Kevin O'dell
> >>> <kevin.odell@cloudera.com <javascript:;>>wrote:
> >>>
> >>>> I am a bad person, but I have that JIRA in my name.  I need to make
> the
> >>>> patch pretty.
> >>>>
> >>>> https://issues.apache.org/jira/browse/HBASE-5525
> >>>>
> >>>> There is a patch there that works, it is just not pretty.
> >>>>
> >>>> On Tue, Feb 5, 2013 at 12:28 PM, Ted Yu <yuzhihong@gmail.com
> <javascript:;>>
> >> wrote:
> >>>>
> >>>>> To my knowledge there is no such tool.
> >>>>>
> >>>>> You can file a JIRA in case someone has bandwidth to work on such
> >> tool.
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>> On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <
> >>>>> jean-marc@spaggiari.org <javascript:;>
> >>>>>> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> Is there an easy way to empty a table but keep the regions? Truncate
> >>>>>> will remove everything even the splitting. But I want to keep the
> >>>>>> regions the way they are. I just want to clean them. Is there a
> >>>>>> simple
> >>>>>> way to do that with the shell or something like that?
> >>>>>>
> >>>>>> Thanks,
> >>>>>>
> >>>>>> JM
> >>>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Kevin O'Dell
> >>>> Customer Operations Engineer, Cloudera
> >>>>
> >>>
> >>
> >
> >
> > --
> > Best regards,
> >
> >   - Andy
> >
> > Problems worthy of attack prove their worth by hitting back. - Piet Hein
> > (via Tom White)
>
> The opinions expressed here are mine, while they may reflect a cognitive
> thought, that is purely accidental.
> Use at your own risk.
> Michael Segel
> michael_segel (AT) hotmail.com
>
>
>
>
>
>

Re: Empty a table

Posted by Michael Segel <mi...@hotmail.com>.
I think its more akin of the typical 'truncate' command. 

Actually, if someone wanted to extend HBase Shell, I would imagine a simple Ruby er JRuby script could do this? (You would want to disable the table first) 

Just a thought. 

On Feb 5, 2013, at 12:36 PM, Andrew Purtell <ap...@apache.org> wrote:

> If there is a time consideration here, perhaps you want to do this because
> the data isn't interesting after some time interval has elapsed but the
> keyspace for new entries will be similar -- then consider using TTLs. It's
> easy and they will do what you want, garbage collecting useless data while
> not changing region boundaries.
> 
> On Tuesday, February 5, 2013, Jean-Marc Spaggiari wrote:
> 
>> Nive to see that it's already in progress ;)
>> 
>> Tian-Ying, thanks for the idea. I will most probably give it a try!
>> 
>> JM
>> 
>> 2013/2/5, Ted Yu <yuzhihong@gmail.com <javascript:;>>:
>>> Looks like a little polishing would make the tool available in 0.96 :-)
>>> 
>>> On Tue, Feb 5, 2013 at 9:38 AM, Kevin O'dell
>>> <kevin.odell@cloudera.com <javascript:;>>wrote:
>>> 
>>>> I am a bad person, but I have that JIRA in my name.  I need to make the
>>>> patch pretty.
>>>> 
>>>> https://issues.apache.org/jira/browse/HBASE-5525
>>>> 
>>>> There is a patch there that works, it is just not pretty.
>>>> 
>>>> On Tue, Feb 5, 2013 at 12:28 PM, Ted Yu <yuzhihong@gmail.com<javascript:;>>
>> wrote:
>>>> 
>>>>> To my knowledge there is no such tool.
>>>>> 
>>>>> You can file a JIRA in case someone has bandwidth to work on such
>> tool.
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <
>>>>> jean-marc@spaggiari.org <javascript:;>
>>>>>> wrote:
>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> Is there an easy way to empty a table but keep the regions? Truncate
>>>>>> will remove everything even the splitting. But I want to keep the
>>>>>> regions the way they are. I just want to clean them. Is there a
>>>>>> simple
>>>>>> way to do that with the shell or something like that?
>>>>>> 
>>>>>> Thanks,
>>>>>> 
>>>>>> JM
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Kevin O'Dell
>>>> Customer Operations Engineer, Cloudera
>>>> 
>>> 
>> 
> 
> 
> -- 
> Best regards,
> 
>   - Andy
> 
> Problems worthy of attack prove their worth by hitting back. - Piet Hein
> (via Tom White)

The opinions expressed here are mine, while they may reflect a cognitive thought, that is purely accidental. 
Use at your own risk. 
Michael Segel
michael_segel (AT) hotmail.com






Re: Empty a table

Posted by Andrew Purtell <ap...@apache.org>.
If there is a time consideration here, perhaps you want to do this because
the data isn't interesting after some time interval has elapsed but the
keyspace for new entries will be similar -- then consider using TTLs. It's
easy and they will do what you want, garbage collecting useless data while
not changing region boundaries.

On Tuesday, February 5, 2013, Jean-Marc Spaggiari wrote:

> Nive to see that it's already in progress ;)
>
> Tian-Ying, thanks for the idea. I will most probably give it a try!
>
> JM
>
> 2013/2/5, Ted Yu <yuzhihong@gmail.com <javascript:;>>:
> > Looks like a little polishing would make the tool available in 0.96 :-)
> >
> > On Tue, Feb 5, 2013 at 9:38 AM, Kevin O'dell
> > <kevin.odell@cloudera.com <javascript:;>>wrote:
> >
> >> I am a bad person, but I have that JIRA in my name.  I need to make the
> >> patch pretty.
> >>
> >> https://issues.apache.org/jira/browse/HBASE-5525
> >>
> >> There is a patch there that works, it is just not pretty.
> >>
> >> On Tue, Feb 5, 2013 at 12:28 PM, Ted Yu <yuzhihong@gmail.com<javascript:;>>
> wrote:
> >>
> >> > To my knowledge there is no such tool.
> >> >
> >> > You can file a JIRA in case someone has bandwidth to work on such
> tool.
> >> >
> >> > Thanks
> >> >
> >> > On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <
> >> > jean-marc@spaggiari.org <javascript:;>
> >> > > wrote:
> >> >
> >> > > Hi,
> >> > >
> >> > > Is there an easy way to empty a table but keep the regions? Truncate
> >> > > will remove everything even the splitting. But I want to keep the
> >> > > regions the way they are. I just want to clean them. Is there a
> >> > > simple
> >> > > way to do that with the shell or something like that?
> >> > >
> >> > > Thanks,
> >> > >
> >> > > JM
> >> > >
> >> >
> >>
> >>
> >>
> >> --
> >> Kevin O'Dell
> >> Customer Operations Engineer, Cloudera
> >>
> >
>


-- 
Best regards,

   - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein
(via Tom White)

Re: Empty a table

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Nive to see that it's already in progress ;)

Tian-Ying, thanks for the idea. I will most probably give it a try!

JM

2013/2/5, Ted Yu <yu...@gmail.com>:
> Looks like a little polishing would make the tool available in 0.96 :-)
>
> On Tue, Feb 5, 2013 at 9:38 AM, Kevin O'dell
> <ke...@cloudera.com>wrote:
>
>> I am a bad person, but I have that JIRA in my name.  I need to make the
>> patch pretty.
>>
>> https://issues.apache.org/jira/browse/HBASE-5525
>>
>> There is a patch there that works, it is just not pretty.
>>
>> On Tue, Feb 5, 2013 at 12:28 PM, Ted Yu <yu...@gmail.com> wrote:
>>
>> > To my knowledge there is no such tool.
>> >
>> > You can file a JIRA in case someone has bandwidth to work on such tool.
>> >
>> > Thanks
>> >
>> > On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <
>> > jean-marc@spaggiari.org
>> > > wrote:
>> >
>> > > Hi,
>> > >
>> > > Is there an easy way to empty a table but keep the regions? Truncate
>> > > will remove everything even the splitting. But I want to keep the
>> > > regions the way they are. I just want to clean them. Is there a
>> > > simple
>> > > way to do that with the shell or something like that?
>> > >
>> > > Thanks,
>> > >
>> > > JM
>> > >
>> >
>>
>>
>>
>> --
>> Kevin O'Dell
>> Customer Operations Engineer, Cloudera
>>
>

Re: Empty a table

Posted by Ted Yu <yu...@gmail.com>.
Looks like a little polishing would make the tool available in 0.96 :-)

On Tue, Feb 5, 2013 at 9:38 AM, Kevin O'dell <ke...@cloudera.com>wrote:

> I am a bad person, but I have that JIRA in my name.  I need to make the
> patch pretty.
>
> https://issues.apache.org/jira/browse/HBASE-5525
>
> There is a patch there that works, it is just not pretty.
>
> On Tue, Feb 5, 2013 at 12:28 PM, Ted Yu <yu...@gmail.com> wrote:
>
> > To my knowledge there is no such tool.
> >
> > You can file a JIRA in case someone has bandwidth to work on such tool.
> >
> > Thanks
> >
> > On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <
> > jean-marc@spaggiari.org
> > > wrote:
> >
> > > Hi,
> > >
> > > Is there an easy way to empty a table but keep the regions? Truncate
> > > will remove everything even the splitting. But I want to keep the
> > > regions the way they are. I just want to clean them. Is there a simple
> > > way to do that with the shell or something like that?
> > >
> > > Thanks,
> > >
> > > JM
> > >
> >
>
>
>
> --
> Kevin O'Dell
> Customer Operations Engineer, Cloudera
>

Re: Empty a table

Posted by Kevin O'dell <ke...@cloudera.com>.
I am a bad person, but I have that JIRA in my name.  I need to make the
patch pretty.

https://issues.apache.org/jira/browse/HBASE-5525

There is a patch there that works, it is just not pretty.

On Tue, Feb 5, 2013 at 12:28 PM, Ted Yu <yu...@gmail.com> wrote:

> To my knowledge there is no such tool.
>
> You can file a JIRA in case someone has bandwidth to work on such tool.
>
> Thanks
>
> On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org
> > wrote:
>
> > Hi,
> >
> > Is there an easy way to empty a table but keep the regions? Truncate
> > will remove everything even the splitting. But I want to keep the
> > regions the way they are. I just want to clean them. Is there a simple
> > way to do that with the shell or something like that?
> >
> > Thanks,
> >
> > JM
> >
>



-- 
Kevin O'Dell
Customer Operations Engineer, Cloudera

RE: Empty a table

Posted by Tianying Chang <ti...@ebaysf.com>.
You can achieve this goal by deleting all the HFiles of this table. Remember just Hfile, but not the region folders. We did it before with a simple script  that loop through the Hfiles, very easy. 

Thanks
Tian-Ying 

-----Original Message-----
From: Ted Yu [mailto:yuzhihong@gmail.com] 
Sent: Tuesday, February 05, 2013 9:28 AM
To: user@hbase.apache.org
Subject: Re: Empty a table

To my knowledge there is no such tool.

You can file a JIRA in case someone has bandwidth to work on such tool.

Thanks

On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
> wrote:

> Hi,
>
> Is there an easy way to empty a table but keep the regions? Truncate 
> will remove everything even the splitting. But I want to keep the 
> regions the way they are. I just want to clean them. Is there a simple 
> way to do that with the shell or something like that?
>
> Thanks,
>
> JM
>

Re: Empty a table

Posted by Ted Yu <yu...@gmail.com>.
To my knowledge there is no such tool.

You can file a JIRA in case someone has bandwidth to work on such tool.

Thanks

On Tue, Feb 5, 2013 at 8:13 AM, Jean-Marc Spaggiari <jean-marc@spaggiari.org
> wrote:

> Hi,
>
> Is there an easy way to empty a table but keep the regions? Truncate
> will remove everything even the splitting. But I want to keep the
> regions the way they are. I just want to clean them. Is there a simple
> way to do that with the shell or something like that?
>
> Thanks,
>
> JM
>