You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2013/03/29 21:50:31 UTC

svn commit: r1462641 - in /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase: ./ coprocessor/ master/ util/

Author: apurtell
Date: Fri Mar 29 20:50:29 2013
New Revision: 1462641

URL: http://svn.apache.org/r1462641
Log:
Amend HBASE-8209. Revert changes to HBaseTestingUtility#waitUntilAllRegionsAssigned

Modified:
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1462641&r1=1462640&r2=1462641&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Fri Mar 29 20:50:29 2013
@@ -1835,45 +1835,29 @@ public class HBaseTestingUtility {
    * @param countOfRegions How many regions in .META.
    * @throws IOException
    */
-  public void waitUntilAllRegionsAssigned(final byte[] tableName, final int countOfRegions)
+  public void waitUntilAllRegionsAssigned(final int countOfRegions)
   throws IOException {
-    int retries = 30; // We may wait up to 30 seconds
-    int rows = 0;
     HTable meta = new HTable(getConfiguration(), HConstants.META_TABLE_NAME);
-    try {
-      do {
-        Scan scan = new Scan();
-        scan.addColumn(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);
-        scan.addColumn(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-        ResultScanner s = meta.getScanner(scan);
-        try {
-          for (Result r = null; (r = s.next()) != null;) {
-            byte[] b = r.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);
-            HRegionInfo hri = Writables.getHRegionInfoOrNull(b);
-            if (hri != null && Bytes.equals(hri.getTableName(), tableName)) {
-              b = r.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-              if (b == null || b.length <= 0) {
-                continue;
-              }
-              rows++;
-            }
-          }
-        } finally {
-          s.close();
-        }
-        // If I get to here and all rows have a Server, then all have been assigned.
-        if (rows == countOfRegions) {
+    while (true) {
+      int rows = 0;
+      Scan scan = new Scan();
+      scan.addColumn(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
+      ResultScanner s = meta.getScanner(scan);
+      for (Result r = null; (r = s.next()) != null;) {
+        byte [] b =
+          r.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
+        if (b == null || b.length <= 0) {
           break;
         }
-        LOG.info("Found=" + rows);
-        Threads.sleep(1000);
-      } while (--retries > 0);
-    } finally {
-      meta.close();
-    }
-    if (rows != countOfRegions) {
-      throw new IOException("Timed out waiting for " + countOfRegions + " regions of " +
-        Bytes.toStringBinary(tableName) + " to come online");
+        rows++;
+      }
+      s.close();
+      // If I get to here and all rows have a Server, then all have been assigned.
+      if (rows == countOfRegions) {
+        break;
+      }
+      LOG.info("Found=" + rows);
+      Threads.sleep(200);
     }
   }
 

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java?rev=1462641&r1=1462640&r2=1462641&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java Fri Mar 29 20:50:29 2013
@@ -748,7 +748,7 @@ public class TestMasterObserver {
 
     HTable table = UTIL.createTable(TEST_TABLE, TEST_FAMILY);
     int countOfRegions = UTIL.createMultiRegions(table, TEST_FAMILY);
-    UTIL.waitUntilAllRegionsAssigned(TEST_TABLE, countOfRegions);
+    UTIL.waitUntilAllRegionsAssigned(countOfRegions);
     
     NavigableMap<HRegionInfo, ServerName> regions = table.getRegionLocations();
     Map.Entry<HRegionInfo, ServerName> firstGoodPair = null;

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java?rev=1462641&r1=1462640&r2=1462641&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java Fri Mar 29 20:50:29 2013
@@ -109,7 +109,7 @@ public class TestRegionServerCoprocessor
     byte[] TEST_FAMILY = Bytes.toBytes("aaa");
 
     HTable table = TEST_UTIL.createTable(TEST_TABLE, TEST_FAMILY);
-    TEST_UTIL.waitUntilAllRegionsAssigned(TEST_TABLE,
+    TEST_UTIL.waitUntilAllRegionsAssigned(
         TEST_UTIL.createMultiRegions(table, TEST_FAMILY));
 
     // Note which regionServer will abort (after put is attempted).

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java?rev=1462641&r1=1462640&r2=1462641&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java Fri Mar 29 20:50:29 2013
@@ -92,7 +92,7 @@ public class TestRegionServerCoprocessor
     byte[] TEST_FAMILY = Bytes.toBytes("aaa");
 
     HTable table = TEST_UTIL.createTable(TEST_TABLE, TEST_FAMILY);
-    TEST_UTIL.waitUntilAllRegionsAssigned(TEST_TABLE,
+    TEST_UTIL.waitUntilAllRegionsAssigned(
         TEST_UTIL.createMultiRegions(table, TEST_FAMILY));
     // Note which regionServer that should survive the buggy coprocessor's
     // prePut().

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java?rev=1462641&r1=1462640&r2=1462641&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java Fri Mar 29 20:50:29 2013
@@ -62,7 +62,7 @@ public class TestMasterTransitions {
     TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES);
     HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
     int countOfRegions = TEST_UTIL.createMultiRegions(t, getTestFamily());
-    TEST_UTIL.waitUntilAllRegionsAssigned(Bytes.toBytes(TABLENAME), countOfRegions);
+    TEST_UTIL.waitUntilAllRegionsAssigned(countOfRegions);
     addToEachStartKey(countOfRegions);
     t.close();
   }

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java?rev=1462641&r1=1462640&r2=1462641&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java Fri Mar 29 20:50:29 2013
@@ -137,7 +137,7 @@ public class TestMiniClusterLoadSequenti
   protected void createPreSplitLoadTestTable(HTableDescriptor htd, HColumnDescriptor hcd)
       throws IOException {
     int numRegions = HBaseTestingUtility.createPreSplitLoadTestTable(conf, htd, hcd);
-    TEST_UTIL.waitUntilAllRegionsAssigned(htd.getName(), numRegions);
+    TEST_UTIL.waitUntilAllRegionsAssigned(numRegions);
   }
 
   protected void prepareForLoadTest() throws IOException {