hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject hbase git commit: HBASE-12479 Backport HBASE-11689 (Track meta in transition) (Virag Kothari); addendum
Date Mon, 01 Dec 2014 03:49:46 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 9e9d3f4ce -> 679e164e3


HBASE-12479 Backport HBASE-11689 (Track meta in transition) (Virag Kothari); addendum

Test fix for TestAssignmentManagerOnCluster


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

Branch: refs/heads/0.98
Commit: 679e164e39066dfe9129fe7fada2fa5c3aac5b98
Parents: 9e9d3f4
Author: Andrew Purtell <apurtell@apache.org>
Authored: Sun Nov 30 22:46:52 2014 -0500
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Sun Nov 30 22:46:55 2014 -0500

----------------------------------------------------------------------
 .../master/TestAssignmentManagerOnCluster.java  | 21 +++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/679e164e/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
index 36acdfa..57be3de 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
@@ -65,6 +65,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ConfigUtil;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
 import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.hbase.zookeeper.ZKAssign;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
 import org.apache.zookeeper.KeeperException;
@@ -208,7 +209,7 @@ public class TestAssignmentManagerOnCluster {
     TEST_UTIL.getMiniHBaseCluster().getConf().setInt("hbase.assignment.maximum.attempts",
20);
     TEST_UTIL.getMiniHBaseCluster().stopMaster(0);
     TEST_UTIL.getMiniHBaseCluster().startMaster(); //restart the master so that conf take
into affect
-
+   
     ServerName deadServer = null;
     HMaster master = null;
     try {
@@ -263,6 +264,11 @@ public class TestAssignmentManagerOnCluster {
       ServerName masterServerName = TEST_UTIL.getMiniHBaseCluster().getMaster().getServerName();
       TEST_UTIL.getMiniHBaseCluster().stopMaster(masterServerName);
       TEST_UTIL.getMiniHBaseCluster().startMaster();
+      // Wait till master is active and is initialized
+      while (TEST_UTIL.getMiniHBaseCluster().getMaster() == null
+          || !TEST_UTIL.getMiniHBaseCluster().getMaster().isInitialized()) {
+        Threads.sleep(1);
+      }
     }
   }
 
@@ -626,6 +632,19 @@ public class TestAssignmentManagerOnCluster {
           break;
         }
       }
+      ServerName metaServerName = am.getRegionStates().getRegionServerOfRegion(HRegionInfo.FIRST_META_REGIONINFO);
+      // We don't want to process shutdown of meta, so move meta if required
+      if (ServerName.isSameHostnameAndPort(destServerName, metaServerName)) {
+        int i = TEST_UTIL.getHBaseCluster().getServerWithMeta();
+        HRegionServer rs = TEST_UTIL.getHBaseCluster().getRegionServer(i == 0 ? 1 : 0);
+        TEST_UTIL
+            .getHBaseCluster()
+            .getMaster()
+            .move(HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
+              Bytes.toBytes(rs.getServerName().getServerName()));
+        am.waitForAssignment(HRegionInfo.FIRST_META_REGIONINFO);
+      }
+      
       am.regionOffline(hri);
       ZooKeeperWatcher zkw = TEST_UTIL.getHBaseCluster().getMaster().getZooKeeper();
       am.getRegionStates().updateRegionState(hri, State.PENDING_OPEN, destServerName);


Mime
View raw message