hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1463195 - in /hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase: HBaseTestingUtility.java master/TestTableLockManager.java
Date Mon, 01 Apr 2013 16:32:30 GMT
Author: stack
Date: Mon Apr  1 16:32:30 2013
New Revision: 1463195

URL: http://svn.apache.org/r1463195
Log:
HBASE-8164 TestTableLockManager fails intermittently in trunk builds

Modified:
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1463195&r1=1463194&r2=1463195&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
Mon Apr  1 16:32:30 2013
@@ -1943,15 +1943,20 @@ public class HBaseTestingUtility extends
         attempted.clear();
       }
       regCount = regions.size();
-      idx = random.nextInt(regions.size());
-      // if we have just tried this region, there is no need to try again
-      if (attempted.contains(idx)) continue;
-      try {
-        regions.get(idx).checkSplit();
-        return regions.get(idx);
-      } catch (Exception ex) {
-        LOG.warn("Caught exception", ex);
-        attempted.add(idx);
+      // There are chances that before we get the region for the table from an RS the region
may
+      // be going for CLOSE.  This may be because online schema change is enabled 
+      if (regCount > 0) {
+        idx = random.nextInt(regCount);
+        // if we have just tried this region, there is no need to try again
+        if (attempted.contains(idx))
+          continue;
+        try {
+          regions.get(idx).checkSplit();
+          return regions.get(idx);
+        } catch (Exception ex) {
+          LOG.warn("Caught exception", ex);
+          attempted.add(idx);
+        }
       }
       attempts++;
     } while (maxAttempts == -1 || attempts < maxAttempts);

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java?rev=1463195&r1=1463194&r2=1463195&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java
Mon Apr  1 16:32:30 2013
@@ -355,10 +355,16 @@ public class TestTableLockManager {
       public void chore() {
         try {
           HRegion region = TEST_UTIL.getSplittableRegion(tableName, -1);
-          byte[] regionName = region.getRegionName();
-          admin.flush(regionName);
-          admin.compact(regionName);
-          admin.split(regionName);
+          if (region != null) {
+            byte[] regionName = region.getRegionName();
+            admin.flush(regionName);
+            admin.compact(regionName);
+            admin.split(regionName);
+          } else {
+            LOG.warn("Could not find suitable region for the table.  Possibly the " +
+              "region got closed and the attempts got over before " +
+              "the region could have got reassigned.");
+          }
         } catch (NotServingRegionException nsre) {
           // the region may be in transition
           LOG.warn("Caught exception", nsre);



Mime
View raw message