hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wei Tan <w...@us.ibm.com>
Subject Re: Retrieve Put timestamp
Date Wed, 01 Aug 2012 18:12:55 GMT
We have a similar requirement and here is the solution in our mind:
add a coprocessor, in prePut() get the current ms and set it to put --- 
the current implementation get the current ms and set it in put()
return the ms generated to prePut() to client. For now put() does not 
return any value. we need to change the behavior of it

Any flaw in this design?


From:   lars hofhansl <lhofhansl@yahoo.com>
To:     "user@hbase.apache.org" <user@hbase.apache.org>, 
Date:   08/01/2012 12:37 PM
Subject:        Re: Retrieve Put timestamp

There is no HBase API for this.
However, this could useful in some scenario, so maybe we could add an API 
for this.
It's not entirely trivial, though.
From: Pablo Musa <pablo@psafe.com>
To: "user@hbase.apache.org" <user@hbase.apache.org> 
Sent: Monday, July 30, 2012 3:13 PM
Subject: Retrieve Put timestamp

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 
* 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 
* this option causes.*/
public void put(Put put) throws IOException {
    byte[] row = put.getRow();
    KeyValue kv = hTableInterface.get(new 
Get(row)).getColumnLatest(family, qualifier);
    long version = kv.getTimestamp();

Is there any better way to do it?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message