Author: larsh
Date: Mon Dec 30 05:50:20 2013
New Revision: 1554146
URL: http://svn.apache.org/r1554146
Log:
HBASE-10250 [0.94] TestHLog fails occasionally
Modified:
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Modified:
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
URL:
http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java?rev=1554146&r1=1554145&r2=1554146&view=diff
==============================================================================
---
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
(original)
+++
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Mon Dec 30 05:50:20 2013
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.lang.reflect.Method;
+import java.net.BindException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -436,7 +437,17 @@ public class TestHLog {
// the idle time threshold configured in the conf above
Thread.sleep(2000);
- cluster = new MiniDFSCluster(namenodePort, conf, 5, false, true, true,
null, null, null, null);
+ cluster = null;
+ // retry a few times if the port is not freed, yet.
+ for (int i = 0; i < 30; i++) {
+ try {
+ cluster = new MiniDFSCluster(namenodePort, conf, 5, false, true,
true, null, null, null, null);
+ break;
+ } catch (BindException e) {
+ LOG.info("Sleeping. BindException bringing up new cluster");
+ Thread.sleep(1000);
+ }
+ }
TEST_UTIL.setDFSCluster(cluster);
cluster.waitActive();
fs = cluster.getFileSystem();