HBASE-4690 Intermittent TestRegionServerCoprocessorExceptionWithAbort failure

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1195250 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-10-30 21:17:30 +00:00
parent 7918625952
commit fb97e1381a
2 changed files with 17 additions and 1 deletions

View File

@ -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

View File

@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
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.regionserver.Store;
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();
}