In newer releases, there are multiple mechanisms where your scenario can be implemented.
Please consider upgrading your deployment. Some references: https://blogs.apache.org/hbase/entry/coprocessor_introduction src/main/java/org/apache/hadoop/hbase/coprocessor/MultiRowMutationEndpoint.java (0.94) On Fri, Feb 28, 2014 at 10:44 AM, Shailesh Samudrala <shailesh2...@gmail.com > wrote: > The version I'm using is 0.90.6. > > We are trying to implement rowLock & rowUnLock on a HBase table to support > our multi-operation transactions on a JSON object(receive value from user > -> read HBase row -> calculate new value based on received value and > current value in HBase -> put new Value to HBase) > > We want the transaction to go through without any writes occurring in > between from other processes which also access the table, therefore we are > trying to implement this using RowLocks. > > > > > > On Thu, Feb 27, 2014 at 10:16 PM, Ted Yu <yuzhih...@gmail.com> wrote: > >> You're using 0.94, right ? >> >> RowLock has been dropped since 0.96.0 >> >> Can you tell us more about your use case ? >> >> >> On Thu, Feb 27, 2014 at 9:56 PM, Shailesh Samudrala < >> shailesh2...@gmail.com> wrote: >> >>> I'm running a sample code I wrote to test HBase lockRow() and >>> unlockRow() methods. The sample code is below: >>> >>> HTable table = new HTable(config, "test"); >>> RowLock rowLock = table.lockRow(Bytes.toBytes(row)); >>> System.out.println("Obtained rowlock on " + row + "\nRowLock: " + rowLock); >>> >>> Put p = new Put(Bytes.toBytes(row)); >>> p.add(Bytes.toBytes("colFamily"), Bytes.toBytes(colFamily), >>> Bytes.toBytes(value)); >>> table.put(p); >>> System.out.println("put row"); >>> table.unlockRow(rowLock); >>> System.out.println("Unlocked row!"); >>> >>> >>> When I execute my code, I get an UnknownRowLockException. The >>> documentation says that this error is thrown when an unknown row lock is >>> passed to the region servers. I'm not sure how this is happening & how to >>> resolve it. >>> >>> The stack trace is below: >>> >>> Obtained rowlock on row2 >>> RowLock: org.apache.hadoop.hbase.client.RowLock@15af33d6 >>> put row >>> Exception in thread "main" org.apache.hadoop.hbase.UnknownRowLockException: >>> org.apache.hadoop.hbase.UnknownRowLockException: 5763272717012243790 >>> at >>> org.apache.hadoop.hbase.regionserver.HRegionServer.unlockRow(HRegionServer.java:2099) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> at org.apache.hadoop.hbase.ipc.HBaseRPC$Server.call(HBaseRPC.java:604) >>> at >>> org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1055) >>> >>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) >>> at >>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) >>> at >>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) >>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513) >>> at >>> org.apache.hadoop.hbase.RemoteExceptionHandler.decodeRemoteException(RemoteExceptionHandler.java:96) >>> at >>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.translateException(HConnectionManager.java:1268) >>> at >>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getRegionServerWithRetries(HConnectionManager.java:1014) >>> at org.apache.hadoop.hbase.client.HTable.unlockRow(HTable.java:870) >>> at HelloWorld.Hello.HelloWorld.main(HelloWorld.java:41) >>> >>> >> >