[ 
https://issues.apache.org/jira/browse/HBASE-5329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13205502#comment-13205502
 ] 

liaoxiangui commented on HBASE-5329:
------------------------------------

sorry, i didn`t describle it clearly.
I thinks there is possibility that Random.nextLong() generate same number.
To get consequences what the same number lead to, I changed code follow this, 
and got the Leases$LeaseStillHeldException.

{code}
protected long addRowLock(Integer r, HRegion region) throws 
LeaseStillHeldException
{
        long lockId = -1L;
        lockId = 99; 
        String lockName = String.valueOf(lockId);
        rowlocks.put(lockName, r);
        this.leases.createLease(lockName, new RowLockListener(lockName, 
region));
        return lockId;
}
{code}
                
> 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 Yu
>            Priority: Critical
>
> {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


Reply via email to