See this thread for previous discussion on RowLocks : http://search-hadoop.com/m/b60Oj2IFfL3/Rowlocks+are+used+by+RegionServers&subj=Re+RowLocks
On Fri, Feb 28, 2014 at 1:09 AM, kaushik m <bigdatac...@gmail.com> wrote: > You should be passing the obtained rowLock object as parameter for the > Constructor of put object. > > On Friday, February 28, 2014, 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) > > > > > > > > >