[
https://issues.apache.org/jira/browse/HBASE-5329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439867#comment-13439867
]
Zhihong Ted Yu commented on HBASE-5329:
---------------------------------------
Thanks for activating this JIRA.
{code}
+ do {
+ lockName = String.valueOf(nextLong());
+ } while (rowlocks.putIfAbsent(lockName, r) != null);
{code}
Indentation is off for the above block.
{code}
+ return Long.parseLong(lockName);
{code}
I prefer the old way of keeping long lockId so that the above parsing can be
omitted.
> addRowLock() may allocate duplicate lock id, causing the client to be blocked
> -----------------------------------------------------------------------------
>
> Key: HBASE-5329
> URL: https://issues.apache.org/jira/browse/HBASE-5329
> Project: HBase
> Issue Type: Bug
> Components: regionserver
> Affects Versions: 0.90.3
> Environment: Red Hat Enterprise Linux Server release 5.4
> Reporter: liaoxiangui
> Assignee: Zhihong Ted Yu
> Priority: Minor
> Attachments: HBASE-5329.patch
>
>
> {code}
> protected long addRowLock(Integer r, HRegion region) throws
> LeaseStillHeldException
> {
> long lockId = -1L;
> lockId = rand.nextLong(); //!!!may generate duplicated
> id,bug?
> String lockName = String.valueOf(lockId);
> rowlocks.put(lockName, r);
> this.leases.createLease(lockName, new RowLockListener(lockName,
> region));
> return lockId;
> }
> {code}
> In addRowLock(),rand may generate duplicated lock id, it may cause
> regionserver throw exception(Leases$LeaseStillHeldException).The client will
> be blocked until old rowlock is released.
> {code}
> 2012-02-03 15:21:50,084 ERROR
> org.apache.hadoop.hbase.regionserver.HRegionServer: Error obtaining row lock
> (fsOk: true)
> org.apache.hadoop.hbase.regionserver.Leases$LeaseStillHeldException
> at
> org.apache.hadoop.hbase.regionserver.Leases.createLease(Leases.java:150)
> at
> org.apache.hadoop.hbase.regionserver.HRegionServer.addRowLock(HRegionServer.java:1986)
> at
> org.apache.hadoop.hbase.regionserver.HRegionServer.lockRow(HRegionServer.java:1963)
> 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:570)
> at
> org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1039)
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira