Reputation: 574
I'm trying to set a TTL to a row at Hbase. I can't set the TTL to the column family because the table already exists and I can't change that.
What I tried is to use setTTL function in the Put operation. But it seems that is not working because information is still there when I make a scan operation to the table even if the time has past.
If I put a negative value in the function, I don't have any data in the table and I think that that would make sense because I'm using a negative ttl, hence the data is not being stored at all...
1) Do you think that I'm using the proper function?
2) Is there a way to see this information (the TTL value for a row) in HBase?
Edit: Here is the output of a describe command (please remind that I can't change TTL value of the column family):
hbase(main):010:0> describe "Snapshot"
Table Snapshot is ENABLED
Snapshot, {CONFIGURATION => {'KeyPrefixRegionSplitPolicy.prefix_length' => '8', 'SPLIT_POLICY' => 'org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy'}}
COLUMN FAMILIES DESCRIPTION
{NAME => 'metadata', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'GZ', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
{NAME => 'sample', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'GZ', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
Edit2: I think I probably have encountered a bug or something strange with HBase version 1.0.0 because TTL is working as expected in most of the cases. But if I set it and before it expires, I force a split in the table, I've found that the TTL won't work anymore. It's like the Cell TTL value is not being maintained in the Split process. I found that it wasn't working for me before because my TTL was aprox. 1 day and I was having some split events in that period of time.
I will verify this behavior in other versions and let you know if I find something new.
Upvotes: 2
Views: 4562
Reputation: 1812
What is your MIN_VERSION parameter on that column family ? As mentioned here, if it is 1, hbase keeps values even ttl has expired.
http://comments.gmane.org/gmane.comp.java.hadoop.hbase.user/44036
(thanks for question, i learned new thing today :))
Upvotes: 2