hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1462639 - in /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase: ./ client/ coprocessor/ master/ regionserver/wal/ util/
Date Fri, 29 Mar 2013 20:50:11 GMT
Author: apurtell
Date: Fri Mar 29 20:50:11 2013
New Revision: 1462639

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

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHTableMultiplexer.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogFiltering.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
Fri Mar 29 20:50:11 2013
@@ -2164,45 +2164,29 @@ public class HBaseTestingUtility extends
    * @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 = HRegionInfo.parseFromOrNull(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/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHTableMultiplexer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHTableMultiplexer.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHTableMultiplexer.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHTableMultiplexer.java
Fri Mar 29 20:50:11 2013
@@ -77,7 +77,7 @@ public class TestHTableMultiplexer {
 
     HTable ht = TEST_UTIL.createTable(TABLE, new byte[][] { FAMILY }, VERSION,
         Bytes.toBytes("aaaaa"), Bytes.toBytes("zzzzz"), NUM_REGIONS);
-    TEST_UTIL.waitUntilAllRegionsAssigned(TABLE, NUM_REGIONS);
+    TEST_UTIL.waitUntilAllRegionsAssigned(NUM_REGIONS);
 
     byte[][] startRows = ht.getStartKeys();
     byte[][] endRows = ht.getEndKeys();

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java
Fri Mar 29 20:50:11 2013
@@ -91,7 +91,7 @@ public class TestCoprocessorEndpoint {
     HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
     desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
     admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
-    util.waitUntilAllRegionsAssigned(TEST_TABLE, 3);
+    util.waitUntilAllRegionsAssigned(3);
     admin.close();
 
     HTable table = new HTable(conf, TEST_TABLE);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
Fri Mar 29 20:50:11 2013
@@ -1110,7 +1110,7 @@ public class TestMasterObserver {
 
     try {
       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/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java
Fri Mar 29 20:50:11 2013
@@ -75,7 +75,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.createMultiRegions(table,
TEST_FAMILY));
+    TEST_UTIL.waitUntilAllRegionsAssigned(TEST_UTIL.createMultiRegions(table, TEST_FAMILY));
 
     // Note which regionServer will abort (after put is attempted).
     final HRegionServer regionServer = TEST_UTIL.getRSForFirstRegionInTable(TEST_TABLE);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithRemove.java
Fri Mar 29 20:50:11 2013
@@ -91,7 +91,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/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
Fri Mar 29 20:50:11 2013
@@ -59,12 +59,11 @@ public class TestMasterTransitions {
   @BeforeClass public static void beforeAllTests() throws Exception {
     TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true);
     TEST_UTIL.startMiniCluster(2);
-    byte[] tableName = Bytes.toBytes(TABLENAME);
     // Create a table of three families.  This will assign a region.
-    TEST_UTIL.createTable(tableName, FAMILIES);
+    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(tableName, countOfRegions);
+    TEST_UTIL.waitUntilAllRegionsAssigned(countOfRegions);
     addToEachStartKey(countOfRegions);
     t.close();
   }

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogFiltering.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogFiltering.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogFiltering.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogFiltering.java
Fri Mar 29 20:50:11 2013
@@ -102,7 +102,7 @@ public class TestHLogFiltering {
         table.flushCommits();
       }
     }
-    TEST_UTIL.waitUntilAllRegionsAssigned(TABLE_NAME, NUM_RS);
+    TEST_UTIL.waitUntilAllRegionsAssigned(NUM_RS);
   }
 
   @Test

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java?rev=1462639&r1=1462638&r2=1462639&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
Fri Mar 29 20:50:11 2013
@@ -141,7 +141,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 {



Mime
View raw message