Viraj Jasani created HBASE-28797:
------------------------------------

             Summary: New version of Region#getRowLock with timeout
                 Key: HBASE-28797
                 URL: https://issues.apache.org/jira/browse/HBASE-28797
             Project: HBase
          Issue Type: Improvement
    Affects Versions: 3.0.0-beta-1, 2.6.0
            Reporter: Viraj Jasani


Region APIs are LimitedPrivate for Coprocs. One of the APIs provided by HBase 
for Coproc use is to acquire row level read/write lock(s):
{code:java}
/**
 * Get a row lock for the specified row. All locks are reentrant. Before 
calling this function
 * make sure that a region operation has already been started (the calling 
thread has already
 * acquired the region-close-guard lock).
 * <p>
 * The obtained locks should be released after use by {@link RowLock#release()}
 * <p>
 * NOTE: the boolean passed here has changed. It used to be a boolean that 
stated whether or not
 * to wait on the lock. Now it is whether it an exclusive lock is requested.
 * @param row      The row actions will be performed against
 * @param readLock is the lock reader or writer. True indicates that a 
non-exclusive lock is
 *                 requested
 * @see #startRegionOperation()
 * @see #startRegionOperation(Operation)
 */
RowLock getRowLock(byte[] row, boolean readLock) throws IOException; {code}
The implementation by default uses config "hbase.rowlock.wait.duration" as row 
level lock timeout for both read and write locks. The default value is quite 
high (~30s).

While updating the cluster level row lock timeout might not be worth for all 
use cases, having new API that takes timeout param would be really helpful for 
critical latency sensitive Coproc APIs.

 

The new signature should be:
{code:java}
RowLock getRowLock(byte[] row, boolean readLock, int timeout) throws 
IOException; {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to