Sohi
Sohi

Reputation: 424

Hbase Table is not showing any versioning

I am using Cloudera Quick Start VM and running hbase on that. Here are my queries:

hbase(main):009:0> create 'test', 'cf'
0 row(s) in 0.4500 seconds

=> Hbase::Table - test
hbase(main):010:0> put 'test', 'row3', 'cf:c', 'value3'
0 row(s) in 0.1950 seconds

hbase(main):011:0> put 'test', 'row3', 'cf:c', 'value4'
0 row(s) in 0.0580 seconds

hbase(main):012:0> scan 'test' 
ROW                                      COLUMN+CELL                                                                                                         
 row3                                    column=cf:c, timestamp=1414148485533, value=value4                                                                  
1 row(s) in 0.0420 seconds

hbase(main):013:0> scan 'test', {VERSIONS => 3}
ROW                                      COLUMN+CELL                                                                                                         
 row3                                    column=cf:c, timestamp=1414148485533, value=value4                                                                  
1 row(s) in 0.0370 seconds

hbase(main):014:0> get 'test', 'row3', {COLUMN => 'cf:c', VERSIONS => 3}
COLUMN                                   CELL                                                                                                                
 cf:c                                    timestamp=1414148485533, value=value4                                                                               
1 row(s) in 0.0230 seconds

It is supposed to show two versions of row3 but later value is overriding previous. I don't know why versions are not appearing.

Upvotes: 0

Views: 583

Answers (1)

Manu Manjunath
Manu Manjunath

Reputation: 6411

When you create the HBase table, specify how many versions you want to store.

In your case, you can do:

create 'test', {NAME => 'cf', VERSIONS => 3}

Upvotes: 5

Related Questions