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

James Taylor commented on PHOENIX-3407:
---------------------------------------

Thanks, [~elserj]. For HBase 1.2, here's the javadoc from the Region interface:
{code}
  /**
   * Tries to acquire a lock on the given row.
   * @param waitForLock if true, will block until the lock is available.
   *        Otherwise, just tries to obtain the lock and returns
   *        false if unavailable.
   * @return the row lock if acquired,
   *   null if waitForLock was false and the lock was not acquired
   * @throws IOException if waitForLock was true and the lock could not be 
acquired after waiting
   */
  RowLock getRowLock(byte[] row, boolean waitForLock) throws IOException;
{code}
But it seems that the meaning of the boolean has changed, as here's the 
implementation:
{code}
  /**
   *
   * 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).
   * @param row The row actions will be performed against
   * @param readLock is the lock reader or writer. True indicates that a 
non-exlcusive
   *                 lock is requested
   */
  public RowLock getRowLock(byte[] row, boolean readLock) throws IOException {
{code}

Then in HBase 0.98, HRegion still works the old way:
{code}
  /**
   * Tries to acquire a lock on the given row.
   * @param waitForLock if true, will block until the lock is available.
   *        Otherwise, just tries to obtain the lock and returns
   *        false if unavailable.
   * @return the row lock if acquired,
   *   null if waitForLock was false and the lock was not acquired
   * @throws IOException if waitForLock was true and the lock could not be 
acquired after waiting
   */
  public RowLock getRowLock(byte[] row, boolean waitForLock) throws IOException 
{
{code}

Will ping [~busbey] for clarification.

> Wrong type of RowLock acquired by MetaDataEndPointImpl
> ------------------------------------------------------
>
>                 Key: PHOENIX-3407
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3407
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.9.0, 4.8.2
>            Reporter: James Taylor
>            Assignee: James Taylor
>            Priority: Blocker
>
> We're taking a reentrant read lock when we should be taking a write lock in 
> MetaDataEndPointImpl:
> {code}
>         RowLock rowLock = region.getRowLock(key, true);
> {code}
> Not sure if the HBase API changed at some point, but I could have sworn the 
> boolean was for whether or not you wanted to block.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to