Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase, mail # user - Retrieve Put timestamp


+
Pablo Musa 2012-07-30, 22:13
Copy link to this message
-
Re: Retrieve Put timestamp
Asaf Mesika 2012-07-31, 20:07
What do you mean by using TS as version? Are you determining the ts long value before and then setting it in the Put object? If so, I think you can use a specific cell as a counter (Sequence in Oracle language, or Auto Increment column in MySQL). In that case of course you need the value of the TS so that's not a problem.

On 31 ביול 2012, at 01:13, Pablo Musa <[EMAIL PROTECTED]> wrote:

> Hey guys,
> in my application the HBase timestamp is used as version in my logic.
> I would like to know what is the best way to insert a new record and get its timestamp.
>
> I have come up with two possibilities:
>
> /* I could force timestamp, but it is not a good idea since different servers
> * write into HBase which could lead to crazy behavior */
> new Put(row, timestamp);
>
> /* Or I could write into HBase and read it back. But I don't know how much overhead
> * this option causes.*/
> @Override
> public void put(Put put) throws IOException {
>    byte[] row = put.getRow();
>    hTableInterface.put(put);
>    KeyValue kv = hTableInterface.get(new Get(row)).getColumnLatest(family, qualifier);
>    long version = kv.getTimestamp();
> }
>
> Is there any better way to do it?
>
> Thanks,
> Pablo
+
Stack 2012-07-31, 21:12
+
Pablo Musa 2012-07-31, 22:23
+
lars hofhansl 2012-08-01, 16:33
+
Wei Tan 2012-08-01, 18:12
+
Stack 2012-08-01, 22:11
+
Anoop Sam John 2012-08-02, 04:42
+
Ramkrishna.S.Vasudevan 2012-08-02, 04:51
+
Wei Tan 2012-08-02, 16:37
+
Wei Tan 2012-11-14, 00:08