Repository: hbase
Updated Branches:
  refs/heads/branch-1 ca581874b -> 57d3e9e75


HBASE-16816 HMaster.move() should throw exception if region to move is not 
online (Allan Yang)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/57d3e9e7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/57d3e9e7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/57d3e9e7

Branch: refs/heads/branch-1
Commit: 57d3e9e7562b3e7410293d1462075758b1793f88
Parents: ca58187
Author: tedyu <yuzhih...@gmail.com>
Authored: Thu Oct 13 11:11:11 2016 -0700
Committer: tedyu <yuzhih...@gmail.com>
Committed: Thu Oct 13 11:11:11 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/hbase/master/HMaster.java   | 5 +++++
 .../java/org/apache/hadoop/hbase/master/TestWarmupRegion.java   | 2 ++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/57d3e9e7/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index b1051f5..8db8324 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -1501,6 +1501,11 @@ public class HMaster extends HRegionServer implements 
MasterServices, Server {
       getRegionState(Bytes.toString(encodedRegionName));
     if (regionState == null) {
       throw new 
UnknownRegionException(Bytes.toStringBinary(encodedRegionName));
+    } else if (!assignmentManager.getRegionStates()
+        .isRegionOnline(regionState.getRegion())) {
+      throw new HBaseIOException(
+          "moving region not onlined: " + regionState.getRegion() + ", "
+              + regionState);
     }
 
     HRegionInfo hri = regionState.getRegion();

http://git-wip-us.apache.org/repos/asf/hbase/blob/57d3e9e7/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestWarmupRegion.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestWarmupRegion.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestWarmupRegion.java
index 9046397..533363d 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestWarmupRegion.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestWarmupRegion.java
@@ -157,6 +157,8 @@ public class TestWarmupRegion {
        HRegionServer rs = 
TEST_UTIL.getMiniHBaseCluster().getRegionServer(serverid);
        byte [] destName = Bytes.toBytes(rs.getServerName().toString());
        
TEST_UTIL.getMiniHBaseCluster().getMaster().move(info.getEncodedNameAsBytes(), 
destName);
+       //wait region online
+       TEST_UTIL.waitUntilNoRegionsInTransition(1000);
        serverid = (serverid + 1) % 2;
      }
    }

Reply via email to