hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From " Marcos Ortiz Valmaseda" <mlor...@uci.cu>
Subject Re: How to config hbase0.94.2 to retain deleted data
Date Mon, 22 Oct 2012 02:12:20 GMT
+1 for this solution.
A history table can solve this with less troubles

----- Mensaje original -----
De: Michael Segel <michael_segel@hotmail.com>
Para: user@hbase.apache.org
Enviado: Sun, 21 Oct 2012 19:34:04 -0400 (CDT)
Asunto: Re: How to config hbase0.94.2 to retain deleted data

I would suggest that you use your coprocessor to copy the data to a 'backup' table when you
mark them for delete. 
Then as major compaction hits, the rows are deleted from the main table, but still reside
undeleted in your delete table. 
Call it a history table. 


On Oct 21, 2012, at 3:53 PM, yun peng <pengyunmomo@gmail.com> wrote:

> Hi, All,
> I want to retain all deleted key-value pairs in hbase. I have tried to
> config HColumnDescript as follow to make it return deleted.
> 
>  public void postOpen(ObserverContext<RegionCoprocessorEnvironment> e) {
>    HTableDescriptor htd = e.getEnvironment().getRegion().getTableDesc();
>    HColumnDescriptor hcd = htd.getFamily(Bytes.toBytes("cf"));
>    hcd.setKeepDeletedCells(true);
>    hcd.setBlockCacheEnabled(false);
>  }
> 
> However, it does not work for me, as when I issued a delete and then query
> by an older timestamp, the old data does not show up.
> 
> hbase(main):119:0> put 'usertable', "key1", 'cf:c1', "v1", 99
> hbase(main):120:0> put 'usertable', "key1", 'cf:c1', "v2", 101
> hbase(main):121:0> delete 'usertable', "key1", 'cf:c1', 100
> hbase(main):122:0> get 'usertable', 'key1', {COLUMN => 'cf:c1', TIMESTAMP
> => 99, VERSIONS => 4}
> COLUMN                CELL
> 
> 0 row(s) in 0.0040 seconds
> 
> hbase(main):123:0> get 'usertable', 'key1', {COLUMN => 'cf:c1', TIMESTAMP
> => 100, VERSIONS => 4}
> COLUMN                CELL
> 
> 0 row(s) in 0.0050 seconds
> 
> hbase(main):124:0> get 'usertable', 'key1', {COLUMN => 'cf:c1', TIMESTAMP
> => 101, VERSIONS => 4}
> COLUMN                CELL
> 
> cf:c1                timestamp=101, value=v2
> 
> 1 row(s) in 0.0050 seconds
> 
> Note this is a new feature in 0.94.2
> (HBASE-4536<https://issues.apache.org/jira/browse/HBASE-4536>),
> I did not find too many sample code online, so... any one here has
> experience in using HBASE-4536. How should one config
> hbase to enable this feature in hbase?
> 
> Thanks
> Yun


10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci


10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci

Mime
View raw message