xmurobi
xmurobi

Reputation: 439

Why Hbase only return 3 version for a cell no matter I set { VERSION = 100} or not

    v = data.getValues(XP_PHONE);
    for (int i = 0; i < v.length; i++) {
        put.add(COLFAM, COL_PHONE, i, Bytes.toBytes(v[i].trim()));
    }

This is the code I used, the phone numbers should be 8 or more, but after the put has been submitted, I only can view the latest 3 version result in hbase shell. Why? and how to fix it?

Upvotes: 4

Views: 3495

Answers (3)

Neethu Lalitha
Neethu Lalitha

Reputation: 3071

If you insert same value to a column 10 times and request a complete lit of all value retained you will only receive the last 3 versions by default. Which means you will only receive what is configured in the table schema.

Reference: Hbase Definitive Guide

Upvotes: 0

koven2049
koven2049

Reputation: 11

you must use public Get setMaxVersions(int maxVersions) to get more versions or use setTimeStamp(long timestamp) to set the version you want to get

Upvotes: 0

codingFoo
codingFoo

Reputation: 906

When a table is created the max number of versions that can be stored is set. The default for max versions is 3:

http://hbase.apache.org/book/schema.versions.html

You can alter an existing table to change the max number of versions.

Using hshell:

hbase> alter 'table_foo', {NAME => 'column_fam_foo', VERSIONS => 100}

Upvotes: 6

Related Questions