I don't think you can do this. Other than the fact that you cannot change Put's row key (there's simply no interface for that), consider the following notes:
Note-1: row key is used by HBase client (yes, in your app) to find out where (which RegionServer) should handle that put. Note-2: coprocessor (RegionObserver.prePut in particular) invoked on a Region level. By that time Put's row key was already used to find this Region, where it should be stored. Even if you could change it, things could become corrupted, if the new key falls out of this region. I'm sure there's much more to that, why this cannot be done. So, you have to figure out the way to set row key in your client code... Alex Baranau ------ Sematext :: http://blog.sematext.com/ :: Hadoop - HBase - ElasticSearch - Solr On Tue, Jul 24, 2012 at 10:58 AM, Daniel Gorgan - SKIN < [email protected]> wrote: > Hello, > > I'm trying to implement something like autoIncrement in hbase's > coprocessors. > If the rowKey I read in prePut is empty, I will generate a new one, be > sure that it doesn't exists, and use that one. Also, the new key should > return to client. > I'm trying to do this using coprocessors, I know I can do it on the client > side, but I want to try it in coprocessors. > > My question is, how can I modify the rowKey in prePut, if it's empty? > > Thanks. > -- Alex Baranau ------ Sematext :: http://blog.sematext.com/ :: Hadoop - HBase - ElasticSearch - Solr
