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:17:31 UTC

svn commit: r1195250 - in /hbase/trunk: CHANGES.txt src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

Author: tedyu
Date: Sun Oct 30 21:17:30 2011
New Revision: 1195250

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

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

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1195250&r1=1195249&r2=1195250&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun Oct 30 21:17:30 2011
@@ -37,7 +37,7 @@ Release 0.93.0 - Unreleased
    HBASE-4534  A new unit test for lazy seek and StoreScanner in general
                (mikhail via jgray)
    HBASE-4545  TestHLog doesn't clean up after itself
-
+   HBASE-4690  Intermittent TestRegionServerCoprocessorExceptionWithAbort failure
 
 Release 0.92.0 - Unreleased
   INCOMPATIBLE CHANGES

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1195250&r1=1195249&r2=1195250&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Sun Oct 30 21:17:30 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;
@@ -61,6 +62,7 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.regionserver.StoreFile;
 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;
@@ -1131,6 +1133,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();
   }