You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by jo...@gmail.com on 2017/06/21 18:31:51 UTC
Setting TTL at the row level
Hi all,
I know it is possible to set TTL in HBase at the column family level - which makes HBase delete rows in the column family when they reach a certain age.
Rather than expire a row after it's reached a certain age, I would like to expire each specific row at a specific time in the future (I.e. set expiry at the row level, rather than at the column family level). To achieve this, I am planning on setting the column family TTL to something very short (e.g. 1 minute) and then when I write my rows, I will set the row timestamp to [current datetime + time until I want row to expire]. Since HBase uses row timestamp for TTL, this should let me effectively set TTL on the row level.
Will this work? Is there any reason not to do this?
Thanks!
Josh
Re: Setting TTL at the row level
Posted by Josh <jo...@gmail.com>.
Thanks guys for the replies, I missed the cell level TTL feature!
Josh
On Fri, Jun 23, 2017 at 1:01 PM, Anoop John <an...@gmail.com> wrote:
> Yes we have per cell level TTL setting from 0.98.9 release onwards.
> That should be the best way for ur usecase.
> See Mutation#setTTL(long)
>
> -Anoop-
>
> On Fri, Jun 23, 2017 at 2:17 PM, yonghu <yo...@gmail.com> wrote:
> > I did not quite understand what you mean by "row timestamp"? As far as I
> > know, timestamp is associated to each data version (cell). Will you store
> > multiple data versions in a single column?
> >
> >
> >
> > On Thu, Jun 22, 2017 at 4:35 AM, Jean-Marc Spaggiari <
> > jean-marc@spaggiari.org> wrote:
> >
> >> Why not using the cell level ttl?
> >>
> >> Le 2017-06-21 2:35 PM, "Vladimir Rodionov" <vl...@gmail.com> a
> >> écrit :
> >>
> >> > Should work
> >> >
> >> > On Wed, Jun 21, 2017 at 11:31 AM, <jo...@gmail.com> wrote:
> >> >
> >> > > Hi all,
> >> > >
> >> > > I know it is possible to set TTL in HBase at the column family
> level -
> >> > > which makes HBase delete rows in the column family when they reach a
> >> > > certain age.
> >> > >
> >> > > Rather than expire a row after it's reached a certain age, I would
> like
> >> > to
> >> > > expire each specific row at a specific time in the future (I.e. set
> >> > expiry
> >> > > at the row level, rather than at the column family level). To
> achieve
> >> > this,
> >> > > I am planning on setting the column family TTL to something very
> short
> >> > > (e.g. 1 minute) and then when I write my rows, I will set the row
> >> > timestamp
> >> > > to [current datetime + time until I want row to expire]. Since HBase
> >> uses
> >> > > row timestamp for TTL, this should let me effectively set TTL on the
> >> row
> >> > > level.
> >> > >
> >> > > Will this work? Is there any reason not to do this?
> >> > >
> >> > > Thanks!
> >> > > Josh
> >> > >
> >> > >
> >> > >
> >> >
> >>
>
Re: Setting TTL at the row level
Posted by Anoop John <an...@gmail.com>.
Yes we have per cell level TTL setting from 0.98.9 release onwards.
That should be the best way for ur usecase.
See Mutation#setTTL(long)
-Anoop-
On Fri, Jun 23, 2017 at 2:17 PM, yonghu <yo...@gmail.com> wrote:
> I did not quite understand what you mean by "row timestamp"? As far as I
> know, timestamp is associated to each data version (cell). Will you store
> multiple data versions in a single column?
>
>
>
> On Thu, Jun 22, 2017 at 4:35 AM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org> wrote:
>
>> Why not using the cell level ttl?
>>
>> Le 2017-06-21 2:35 PM, "Vladimir Rodionov" <vl...@gmail.com> a
>> écrit :
>>
>> > Should work
>> >
>> > On Wed, Jun 21, 2017 at 11:31 AM, <jo...@gmail.com> wrote:
>> >
>> > > Hi all,
>> > >
>> > > I know it is possible to set TTL in HBase at the column family level -
>> > > which makes HBase delete rows in the column family when they reach a
>> > > certain age.
>> > >
>> > > Rather than expire a row after it's reached a certain age, I would like
>> > to
>> > > expire each specific row at a specific time in the future (I.e. set
>> > expiry
>> > > at the row level, rather than at the column family level). To achieve
>> > this,
>> > > I am planning on setting the column family TTL to something very short
>> > > (e.g. 1 minute) and then when I write my rows, I will set the row
>> > timestamp
>> > > to [current datetime + time until I want row to expire]. Since HBase
>> uses
>> > > row timestamp for TTL, this should let me effectively set TTL on the
>> row
>> > > level.
>> > >
>> > > Will this work? Is there any reason not to do this?
>> > >
>> > > Thanks!
>> > > Josh
>> > >
>> > >
>> > >
>> >
>>
Re: Setting TTL at the row level
Posted by yonghu <yo...@gmail.com>.
I did not quite understand what you mean by "row timestamp"? As far as I
know, timestamp is associated to each data version (cell). Will you store
multiple data versions in a single column?
On Thu, Jun 22, 2017 at 4:35 AM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:
> Why not using the cell level ttl?
>
> Le 2017-06-21 2:35 PM, "Vladimir Rodionov" <vl...@gmail.com> a
> écrit :
>
> > Should work
> >
> > On Wed, Jun 21, 2017 at 11:31 AM, <jo...@gmail.com> wrote:
> >
> > > Hi all,
> > >
> > > I know it is possible to set TTL in HBase at the column family level -
> > > which makes HBase delete rows in the column family when they reach a
> > > certain age.
> > >
> > > Rather than expire a row after it's reached a certain age, I would like
> > to
> > > expire each specific row at a specific time in the future (I.e. set
> > expiry
> > > at the row level, rather than at the column family level). To achieve
> > this,
> > > I am planning on setting the column family TTL to something very short
> > > (e.g. 1 minute) and then when I write my rows, I will set the row
> > timestamp
> > > to [current datetime + time until I want row to expire]. Since HBase
> uses
> > > row timestamp for TTL, this should let me effectively set TTL on the
> row
> > > level.
> > >
> > > Will this work? Is there any reason not to do this?
> > >
> > > Thanks!
> > > Josh
> > >
> > >
> > >
> >
>
Re: Setting TTL at the row level
Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Why not using the cell level ttl?
Le 2017-06-21 2:35 PM, "Vladimir Rodionov" <vl...@gmail.com> a
écrit :
> Should work
>
> On Wed, Jun 21, 2017 at 11:31 AM, <jo...@gmail.com> wrote:
>
> > Hi all,
> >
> > I know it is possible to set TTL in HBase at the column family level -
> > which makes HBase delete rows in the column family when they reach a
> > certain age.
> >
> > Rather than expire a row after it's reached a certain age, I would like
> to
> > expire each specific row at a specific time in the future (I.e. set
> expiry
> > at the row level, rather than at the column family level). To achieve
> this,
> > I am planning on setting the column family TTL to something very short
> > (e.g. 1 minute) and then when I write my rows, I will set the row
> timestamp
> > to [current datetime + time until I want row to expire]. Since HBase uses
> > row timestamp for TTL, this should let me effectively set TTL on the row
> > level.
> >
> > Will this work? Is there any reason not to do this?
> >
> > Thanks!
> > Josh
> >
> >
> >
>
Re: Setting TTL at the row level
Posted by Vladimir Rodionov <vl...@gmail.com>.
Should work
On Wed, Jun 21, 2017 at 11:31 AM, <jo...@gmail.com> wrote:
> Hi all,
>
> I know it is possible to set TTL in HBase at the column family level -
> which makes HBase delete rows in the column family when they reach a
> certain age.
>
> Rather than expire a row after it's reached a certain age, I would like to
> expire each specific row at a specific time in the future (I.e. set expiry
> at the row level, rather than at the column family level). To achieve this,
> I am planning on setting the column family TTL to something very short
> (e.g. 1 minute) and then when I write my rows, I will set the row timestamp
> to [current datetime + time until I want row to expire]. Since HBase uses
> row timestamp for TTL, this should let me effectively set TTL on the row
> level.
>
> Will this work? Is there any reason not to do this?
>
> Thanks!
> Josh
>
>
>