HDFS-6442. Fix TestEditLogAutoroll and TestStandbyCheckpoints failure caused by port conficts. (Contributed by Zesheng Wu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1598078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc1e525da0
commit
e976652a6e
|
@ -598,6 +598,9 @@ Release 2.5.0 - UNRELEASED
|
||||||
HDFS-6227. ShortCircuitCache#unref should purge ShortCircuitReplicas whose
|
HDFS-6227. ShortCircuitCache#unref should purge ShortCircuitReplicas whose
|
||||||
streams have been closed by java interrupts. (Colin Patrick McCabe via jing9)
|
streams have been closed by java interrupts. (Colin Patrick McCabe via jing9)
|
||||||
|
|
||||||
|
HDFS-6442. Fix TestEditLogAutoroll and TestStandbyCheckpoints failure
|
||||||
|
caused by port conficts. (Zesheng Wu via Arpit Agarwal)
|
||||||
|
|
||||||
Release 2.4.1 - UNRELEASED
|
Release 2.4.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -17,11 +17,16 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hdfs.server.namenode;
|
package org.apache.hadoop.hdfs.server.namenode;
|
||||||
|
|
||||||
|
import java.net.BindException;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_PERIOD_KEY;
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_PERIOD_KEY;
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_TXNS_KEY;
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_TXNS_KEY;
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_EDIT_LOG_AUTOROLL_CHECK_INTERVAL_MS;
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_EDIT_LOG_AUTOROLL_CHECK_INTERVAL_MS;
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_EDIT_LOG_AUTOROLL_MULTIPLIER_THRESHOLD;
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_EDIT_LOG_AUTOROLL_MULTIPLIER_THRESHOLD;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
@ -43,6 +48,9 @@ public class TestEditLogAutoroll {
|
||||||
private NameNode nn0;
|
private NameNode nn0;
|
||||||
private FileSystem fs;
|
private FileSystem fs;
|
||||||
private FSEditLog editLog;
|
private FSEditLog editLog;
|
||||||
|
private final Random random = new Random();
|
||||||
|
|
||||||
|
private static final Log LOG = LogFactory.getLog(TestEditLog.class);
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -54,10 +62,14 @@ public class TestEditLogAutoroll {
|
||||||
conf.setFloat(DFS_NAMENODE_EDIT_LOG_AUTOROLL_MULTIPLIER_THRESHOLD, 0.5f);
|
conf.setFloat(DFS_NAMENODE_EDIT_LOG_AUTOROLL_MULTIPLIER_THRESHOLD, 0.5f);
|
||||||
conf.setInt(DFS_NAMENODE_EDIT_LOG_AUTOROLL_CHECK_INTERVAL_MS, 100);
|
conf.setInt(DFS_NAMENODE_EDIT_LOG_AUTOROLL_CHECK_INTERVAL_MS, 100);
|
||||||
|
|
||||||
|
int retryCount = 0;
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
int basePort = 10060 + random.nextInt(100) * 2;
|
||||||
MiniDFSNNTopology topology = new MiniDFSNNTopology()
|
MiniDFSNNTopology topology = new MiniDFSNNTopology()
|
||||||
.addNameservice(new MiniDFSNNTopology.NSConf("ns1")
|
.addNameservice(new MiniDFSNNTopology.NSConf("ns1")
|
||||||
.addNN(new MiniDFSNNTopology.NNConf("nn1").setHttpPort(10061))
|
.addNN(new MiniDFSNNTopology.NNConf("nn1").setHttpPort(basePort))
|
||||||
.addNN(new MiniDFSNNTopology.NNConf("nn2").setHttpPort(10062)));
|
.addNN(new MiniDFSNNTopology.NNConf("nn2").setHttpPort(basePort + 1)));
|
||||||
|
|
||||||
cluster = new MiniDFSCluster.Builder(conf)
|
cluster = new MiniDFSCluster.Builder(conf)
|
||||||
.nnTopology(topology)
|
.nnTopology(topology)
|
||||||
|
@ -72,6 +84,13 @@ public class TestEditLogAutoroll {
|
||||||
|
|
||||||
fs = cluster.getFileSystem(0);
|
fs = cluster.getFileSystem(0);
|
||||||
editLog = nn0.getNamesystem().getEditLog();
|
editLog = nn0.getNamesystem().getEditLog();
|
||||||
|
++retryCount;
|
||||||
|
break;
|
||||||
|
} catch (BindException e) {
|
||||||
|
LOG.info("Set up MiniDFSCluster failed due to port conflicts, retry "
|
||||||
|
+ retryCount + " times");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
|
@ -25,12 +25,14 @@ import static org.junit.Assert.fail;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.net.BindException;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.ThreadInfo;
|
import java.lang.management.ThreadInfo;
|
||||||
import java.lang.management.ThreadMXBean;
|
import java.lang.management.ThreadMXBean;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -73,6 +75,7 @@ public class TestStandbyCheckpoints {
|
||||||
protected MiniDFSCluster cluster;
|
protected MiniDFSCluster cluster;
|
||||||
protected NameNode nn0, nn1;
|
protected NameNode nn0, nn1;
|
||||||
protected FileSystem fs;
|
protected FileSystem fs;
|
||||||
|
private final Random random = new Random();
|
||||||
protected File tmpOivImgDir;
|
protected File tmpOivImgDir;
|
||||||
|
|
||||||
private static final Log LOG = LogFactory.getLog(TestStandbyCheckpoints.class);
|
private static final Log LOG = LogFactory.getLog(TestStandbyCheckpoints.class);
|
||||||
|
@ -87,10 +90,14 @@ public class TestStandbyCheckpoints {
|
||||||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_NUM_CHECKPOINTS_RETAINED_KEY, 1);
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_NUM_CHECKPOINTS_RETAINED_KEY, 1);
|
||||||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_NUM_EXTRA_EDITS_RETAINED_KEY, 0);
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_NUM_EXTRA_EDITS_RETAINED_KEY, 0);
|
||||||
|
|
||||||
|
int retryCount = 0;
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
int basePort = 10060 + random.nextInt(100) * 2;
|
||||||
MiniDFSNNTopology topology = new MiniDFSNNTopology()
|
MiniDFSNNTopology topology = new MiniDFSNNTopology()
|
||||||
.addNameservice(new MiniDFSNNTopology.NSConf("ns1")
|
.addNameservice(new MiniDFSNNTopology.NSConf("ns1")
|
||||||
.addNN(new MiniDFSNNTopology.NNConf("nn1").setHttpPort(10061))
|
.addNN(new MiniDFSNNTopology.NNConf("nn1").setHttpPort(basePort))
|
||||||
.addNN(new MiniDFSNNTopology.NNConf("nn2").setHttpPort(10062)));
|
.addNN(new MiniDFSNNTopology.NNConf("nn2").setHttpPort(basePort + 1)));
|
||||||
|
|
||||||
cluster = new MiniDFSCluster.Builder(conf)
|
cluster = new MiniDFSCluster.Builder(conf)
|
||||||
.nnTopology(topology)
|
.nnTopology(topology)
|
||||||
|
@ -103,6 +110,13 @@ public class TestStandbyCheckpoints {
|
||||||
fs = HATestUtil.configureFailoverFs(cluster, conf);
|
fs = HATestUtil.configureFailoverFs(cluster, conf);
|
||||||
|
|
||||||
cluster.transitionToActive(0);
|
cluster.transitionToActive(0);
|
||||||
|
++retryCount;
|
||||||
|
break;
|
||||||
|
} catch (BindException e) {
|
||||||
|
LOG.info("Set up MiniDFSCluster failed due to port conflicts, retry "
|
||||||
|
+ retryCount + " times");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Configuration setupCommonConfig() {
|
protected Configuration setupCommonConfig() {
|
||||||
|
|
Loading…
Reference in New Issue