hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1100350 - /hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java
Date Fri, 06 May 2011 20:03:01 GMT
Author: stack
Date: Fri May  6 20:03:00 2011
New Revision: 1100350

URL: http://svn.apache.org/viewvc?rev=1100350&view=rev
Log:
HBASE-3744 createTable blocks until all regions are out of transition -- applied addendum

Modified:
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java?rev=1100350&r1=1100349&r2=1100350&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java (original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java Fri May
 6 20:03:00 2011
@@ -46,8 +46,9 @@ import org.apache.hadoop.hbase.TableExis
 import org.apache.hadoop.hbase.TableNotDisabledException;
 import org.apache.hadoop.hbase.TableNotFoundException;
 import org.apache.hadoop.hbase.executor.EventHandler;
-import org.apache.hadoop.hbase.executor.EventHandler.EventType;
 import org.apache.hadoop.hbase.executor.ExecutorService;
+import org.apache.hadoop.hbase.executor.EventHandler.EventType;
+import org.apache.hadoop.hbase.master.AssignmentManager;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.AfterClass;
@@ -301,8 +302,21 @@ public class TestAdmin {
   }
 
   protected void verifyRoundRobinDistribution(HTable ht, int expectedRegions) throws IOException
{
-    int numRS = ht.getCurrentNrHRS();
+    MasterServices services = TEST_UTIL.getMiniHBaseCluster().getMaster();
+    AssignmentManager am = services.getAssignmentManager();
     Map<HRegionInfo,HServerAddress> regions = ht.getRegionsInfo();
+    for (HRegionInfo regionInfo : regions.keySet()) {
+      try {
+        am.waitForAssignment(regionInfo);
+      } catch (InterruptedException e) {
+        LOG.info("Interrupted waiting for region to be assigned during " +
+            "create table call", e);
+        Thread.currentThread().interrupt();
+        return;
+      }
+    }    
+    int numRS = ht.getCurrentNrHRS();
+    regions = ht.getRegionsInfo();
     Map<HServerAddress, List<HRegionInfo>> server2Regions = new HashMap<HServerAddress,
List<HRegionInfo>>();
     for (Map.Entry<HRegionInfo,HServerAddress> entry : regions.entrySet()) {
       HServerAddress server = entry.getValue();
@@ -815,4 +829,4 @@ public class TestAdmin {
       this.admin.deleteTable(tableName);
     }
   }
-}
\ No newline at end of file
+}



Mime
View raw message