[ 
https://issues.apache.org/jira/browse/HBASE-16816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Allan Yang updated HBASE-16816:
-------------------------------
    Description: 
The move region function in HMaster only checks whether the region to move 
exists
{code}
if (regionState == null) {
      throw new UnknownRegionException(Bytes.toStringBinary(encodedRegionName));
    }

{code}

It will not return anything if the region is split or in transition which is 
not movable. So the caller has no way to know if the move region operation is 
failed.
It is a problem for "region_move.rb". It only gives up moving a region if a 
exception is thrown.Otherwise, it will wait until a timeout and retry. Without 
a exception, it have no idea the region is not movable.
{code}
begin
      admin.move(Bytes.toBytes(r.getEncodedName()), Bytes.toBytes(newServer))
    rescue java.lang.reflect.UndeclaredThrowableException,
        org.apache.hadoop.hbase.UnknownRegionException => e
      $LOG.info("Exception moving "  + r.getEncodedName() +
        "; split/moved? Continuing: " + e)
      return
    end
 # Wait till its up on new server before moving on
    maxWaitInSeconds = admin.getConfiguration.getInt("hbase.move.wait.max", 60)
    maxWait = Time.now + maxWaitInSeconds
    while Time.now < maxWait
      same = isSameServer(admin, r, original)
      break unless same
      sleep 0.1
    end
  end
{code}




  was:
The move region function in HMaster only checked the region to move if it is 
not exist. 
{code}
if (regionState == null) {
      throw new UnknownRegionException(Bytes.toStringBinary(encodedRegionName));
    }

{code}

It will not return anything if the region is split or in transition which is 
not movable. So the caller has no way to know if the move region operation is 
failed.
It is a problem for "region_move.rb". It only gives up moving a region if a 
exception is thrown.Otherwise, it will wait until a timeout and retry. Without 
a exception, it have no idea the region is not movable.
{code}
begin
      admin.move(Bytes.toBytes(r.getEncodedName()), Bytes.toBytes(newServer))
    rescue java.lang.reflect.UndeclaredThrowableException,
        org.apache.hadoop.hbase.UnknownRegionException => e
      $LOG.info("Exception moving "  + r.getEncodedName() +
        "; split/moved? Continuing: " + e)
      return
    end
 # Wait till its up on new server before moving on
    maxWaitInSeconds = admin.getConfiguration.getInt("hbase.move.wait.max", 60)
    maxWait = Time.now + maxWaitInSeconds
    while Time.now < maxWait
      same = isSameServer(admin, r, original)
      break unless same
      sleep 0.1
    end
  end
{code}





> HMaster.move() should throw exception if region to move is not online
> ---------------------------------------------------------------------
>
>                 Key: HBASE-16816
>                 URL: https://issues.apache.org/jira/browse/HBASE-16816
>             Project: HBase
>          Issue Type: Bug
>          Components: Admin
>    Affects Versions: 1.1.2
>            Reporter: Allan Yang
>            Assignee: Allan Yang
>            Priority: Minor
>         Attachments: HBASE-16816-branch-1.patch
>
>
> The move region function in HMaster only checks whether the region to move 
> exists
> {code}
> if (regionState == null) {
>       throw new 
> UnknownRegionException(Bytes.toStringBinary(encodedRegionName));
>     }
> {code}
> It will not return anything if the region is split or in transition which is 
> not movable. So the caller has no way to know if the move region operation is 
> failed.
> It is a problem for "region_move.rb". It only gives up moving a region if a 
> exception is thrown.Otherwise, it will wait until a timeout and retry. 
> Without a exception, it have no idea the region is not movable.
> {code}
> begin
>       admin.move(Bytes.toBytes(r.getEncodedName()), Bytes.toBytes(newServer))
>     rescue java.lang.reflect.UndeclaredThrowableException,
>         org.apache.hadoop.hbase.UnknownRegionException => e
>       $LOG.info("Exception moving "  + r.getEncodedName() +
>         "; split/moved? Continuing: " + e)
>       return
>     end
>  # Wait till its up on new server before moving on
>     maxWaitInSeconds = admin.getConfiguration.getInt("hbase.move.wait.max", 
> 60)
>     maxWait = Time.now + maxWaitInSeconds
>     while Time.now < maxWait
>       same = isSameServer(admin, r, original)
>       break unless same
>       sleep 0.1
>     end
>   end
> {code}



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

Reply via email to