Correct keeping Deleted Cells

Let us illustrate the basic effect of setting the KEEP_DELETED_CELLS attribute on a table.

Execute those following SQL.

create 'test', {NAME=>'e', VERSIONS=>2147483647}
put 'test', 'r1', 'e:c1', 'value', 10
put 'test', 'r1', 'e:c1', 'value', 12
put 'test', 'r1', 'e:c1', 'value', 14
delete 'test', 'r1', 'e:c1',  11
hbase(main):020:0> scan 'test', {RAW=>true, VERSIONS=>1000}
ROW                                  COLUMN+CELL                                                                           
 r1                                  column=e:c1, timestamp=14, value=value                                                 
 r1                                  column=e:c1, timestamp=12, value=value                                               
 r1                                  column=e:c1, timestamp=11, type=Delete                                                 
 r1                                  column=e:c1, timestamp=10, value=value                                               
1 row(s)
hbase(main):021:0> flush 'test'
Took 0.3362 seconds     
hbase(main):022:0> scan 'test', {RAW=>true, VERSIONS=>1000}
ROW                                  COLUMN+CELL                                  
 r1                                  column=e:c1, timestamp=14, value=value  
 r1                                  column=e:c1, timestamp=12, value=value  
 r1                                  column=e:c1, timestamp=11, type=Delete  
 r1                                  column=e:c1, timestamp=10, value=value
1 row(s)
Took 0.0353 seconds 
hbase(main):023:0> major_compact 'test'
Took 0.0791 seconds                     
hbase(main):024:0> scan 'test', {RAW=>true, VERSIONS=>1000}
ROW                                  COLUMN+CELL                  
 r1                                  column=e:c1, timestamp=14, value=value    
 r1                                  column=e:c1, timestamp=12, value=value   
 r1                                  column=e:c1, timestamp=10, value=value  
1 row(s)
Took 0.0422 seconds  

while execute other SQL statement.

create 'test', {NAME=>'e', VERSIONS=>2147483647, KEEP_DELETED_CELLS => true}
put 'test', 'r1', 'e:c1', 'value', 10
put 'test', 'r1', 'e:c1', 'value', 12
put 'test', 'r1', 'e:c1', 'value', 14
delete 'test', 'r1', 'e:c1',  11
hbase(main):007:0> scan 'test', {RAW=>true, VERSIONS=>1000}
ROW                                  COLUMN+CELL                             
 r1                                  column=e:c1, timestamp=14, value=value                
 r1                                  column=e:c1, timestamp=12, value=value                  
 r1                                  column=e:c1, timestamp=11, type=Delete                   
 r1                                  column=e:c1, timestamp=10, value=value              
1 row(s)
Took 0.0706 seconds                                                           
hbase(main):008:0> flush 'test'
Took 0.3657 seconds                                                        
hbase(main):009:0> scan 'test', {RAW=>true, VERSIONS=>1000}
ROW                                  COLUMN+CELL                                                
 r1                                  column=e:c1, timestamp=14, value=value       
 r1                                  column=e:c1, timestamp=12, value=value  
 r1                                  column=e:c1, timestamp=11, type=Delete   
 r1                                  column=e:c1, timestamp=10, value=value 
1 row(s)
Took 0.0361 seconds                    
hbase(main):010:0> major_compact 'test'
Took 0.1340 seconds  
hbase(main):011:0> scan 'test', {RAW=>true, VERSIONS=>1000}
ROW                                  COLUMN+CELL       
 r1                                  column=e:c1, timestamp=14, value=value  
 r1                                  column=e:c1, timestamp=12, value=value                                
 r1                                  column=e:c1, timestamp=11, type=Delete                                
 r1                                  column=e:c1, timestamp=10, value=value    
1 row(s)
Took 0.0270 seconds       

 So ,this thread  https://hbase.apache.org/book.html#cf.keep.deleted contains some sampes has some errorous.

under those following version:

hbase(main):026:0> version
2.2.2, re6513a76c91cceda95dad7af246ac81d46fa2589, Sat Oct 19 10:10:12 UTC 2019
Took 0.0006 seconds 

posted @ 2021-03-30 22:31  lenomail  阅读(38)  评论(0编辑  收藏  举报