HBase Setup Timestamp

I am having problems setting the timestamp string using java api.

When I try to add a timestamp value to place the constructor (or in put.add ()), nothing happens and after reading the rows from the table, I get the timestamps provided by the system.

public static boolean addRecord(String tableName, String rowKey,
    String family, String qualifier, Object value)
{
    try {
        HTable table = new HTable(conf, tableName);
        Put put = new Put(Bytes.toBytes(rowKey), 12345678l);
        put.add(Bytes.toBytes(family), Bytes.toBytes(qualifier), Bytes.toBytes(value.toString()));
        table.put(put);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}

HBase 0.92.1 works offline.

Thanks in advance for your help!

+5
source share
1 answer

Most likely, you already have rows in the table with a timestamp> 12345678l. To make sure this is not the case, try doing it with a very large value for the timestamp, for example Long.MAX_VALUE.

If this is true, you can simply remove the old versions. Then this entry will appear.

+7
source

All Articles