You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2011/10/30 22:20:23 UTC

svn commit: r1195251 - in /hbase/branches/0.92: CHANGES.txt src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

Author: tedyu
Date: Sun Oct 30 21:20:23 2011
New Revision: 1195251

URL: http://svn.apache.org/viewvc?rev=1195251&view=rev
Log:
HBASE-4690  Intermittent TestRegionServerCoprocessorExceptionWithAbort failure

Modified:
    hbase/branches/0.92/CHANGES.txt
    hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1195251&r1=1195250&r2=1195251&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Sun Oct 30 21:20:23 2011
@@ -405,6 +405,7 @@ Release 0.92.0 - Unreleased
                with evictOnClose (jgray)
    HBASE-4651  ConcurrentModificationException might be thrown in
                TestHCM.testConnectionUniqueness (Jinchao)
+   HBASE-4690  Intermittent TestRegionServerCoprocessorExceptionWithAbort failure
 
   IMPROVEMENTS
    HBASE-3290  Max Compaction Size (Nicolas Spiegelberg via Stack)  

Modified: hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1195251&r1=1195250&r2=1195251&view=diff
==============================================================================
--- hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Sun Oct 30 21:20:23 2011
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTru
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InterruptedIOException;
 import java.io.OutputStream;
 import java.lang.reflect.Field;
 import java.security.MessageDigest;
@@ -59,6 +60,7 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.util.Bytes;
+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.util.Writables;
@@ -1111,6 +1113,20 @@ public class HBaseTestingUtility {
     byte [] firstrow = metaRows.get(0);
     LOG.debug("FirstRow=" + Bytes.toString(firstrow));
     int index = hbaseCluster.getServerWith(firstrow);
+    long start = EnvironmentEdgeManager.currentTimeMillis();
+    int timeout = 3000;   // 3sec timeout
+    while (index == -1 &&
+        EnvironmentEdgeManager.currentTimeMillis() - start < timeout) {
+      try {
+        // wait for the region to come online
+        Thread.sleep(50);
+      } catch (InterruptedException ie) {
+        IOException t = new InterruptedIOException();
+        t.initCause(ie);
+        throw t;
+      }
+      index = hbaseCluster.getServerWith(firstrow);
+    }
     return hbaseCluster.getRegionServerThreads().get(index).getRegionServer();
   }