Reputation: 139
I'm having problems setting row timestamp using java api.
When I'm trying to add a timestamp value to put constructor (or into put.add()) nothing happens and after reading rows from table I get system provided timestamps.
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 running in standalone mode.
Thanks in advance for any help!
Upvotes: 5
Views: 6925
Reputation: 35405
Most likely, you already have rows in the table that have timestamp > 12345678l
. To confirm that this is not the case, try it with a very large value for timestamp, say Long.MAX_VALUE
.
If it is indeed the case, you can simply delete the older versions. Then this entry will show up.
Upvotes: 8