HDFS-9333. Some tests using MiniDFSCluster errored complaining port in use. (iwasakims)
(cherry picked from commit964e546ab1
) Conflicts: hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockTokenWithDFSStriped.java (cherry picked from commit1b91ebb714
) (cherry picked from commit1524e63206
)
This commit is contained in:
parent
bd16763591
commit
fd3df4bb04
|
@ -160,6 +160,9 @@ Release 2.7.4 - UNRELEASED
|
||||||
HDFS-10879. TestEncryptionZonesWithKMS#testReadWrite fails intermittently.
|
HDFS-10879. TestEncryptionZonesWithKMS#testReadWrite fails intermittently.
|
||||||
(xiaochen)
|
(xiaochen)
|
||||||
|
|
||||||
|
HDFS-9333. Some tests using MiniDFSCluster errored complaining port in
|
||||||
|
use. (iwasakims)
|
||||||
|
|
||||||
Release 2.7.3 - 2016-08-25
|
Release 2.7.3 - 2016-08-25
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -60,6 +60,7 @@ import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
||||||
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols;
|
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols;
|
||||||
import org.apache.hadoop.io.IOUtils;
|
import org.apache.hadoop.io.IOUtils;
|
||||||
import org.apache.hadoop.net.NetUtils;
|
import org.apache.hadoop.net.NetUtils;
|
||||||
|
import org.apache.hadoop.net.ServerSocketUtil;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -341,7 +342,12 @@ public class TestBlockTokenWithDFS {
|
||||||
Configuration conf = getConf(numDataNodes);
|
Configuration conf = getConf(numDataNodes);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDataNodes).build();
|
// prefer non-ephemeral port to avoid port collision on restartNameNode
|
||||||
|
cluster = new MiniDFSCluster.Builder(conf)
|
||||||
|
.nameNodePort(ServerSocketUtil.getPort(19820, 100))
|
||||||
|
.nameNodeHttpPort(ServerSocketUtil.getPort(19870, 100))
|
||||||
|
.numDataNodes(numDataNodes)
|
||||||
|
.build();
|
||||||
cluster.waitActive();
|
cluster.waitActive();
|
||||||
assertEquals(numDataNodes, cluster.getDataNodes().size());
|
assertEquals(numDataNodes, cluster.getDataNodes().size());
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.hadoop.hdfs.server.namenode.EditLogFileOutputStream;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
||||||
import org.apache.hadoop.hdfs.tools.DFSHAAdmin;
|
import org.apache.hadoop.hdfs.tools.DFSHAAdmin;
|
||||||
import org.apache.hadoop.hdfs.tools.DFSZKFailoverController;
|
import org.apache.hadoop.hdfs.tools.DFSZKFailoverController;
|
||||||
|
import org.apache.hadoop.net.ServerSocketUtil;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.apache.hadoop.test.MultithreadedTestUtil.TestContext;
|
import org.apache.hadoop.test.MultithreadedTestUtil.TestContext;
|
||||||
import org.apache.hadoop.test.MultithreadedTestUtil.TestingThread;
|
import org.apache.hadoop.test.MultithreadedTestUtil.TestingThread;
|
||||||
|
@ -75,14 +76,21 @@ public class TestDFSZKFailoverController extends ClientBaseWithFixes {
|
||||||
conf.setInt(
|
conf.setInt(
|
||||||
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
|
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn1", 10023);
|
|
||||||
conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn2", 10024);
|
|
||||||
|
|
||||||
|
// Get random port numbers in advance. Because ZKFCs and DFSHAAdmin
|
||||||
|
// needs rpc port numbers of all ZKFCs, Setting 0 does not work here.
|
||||||
|
conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn1",
|
||||||
|
ServerSocketUtil.getPort(10023, 100));
|
||||||
|
conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn2",
|
||||||
|
ServerSocketUtil.getPort(10024, 100));
|
||||||
|
|
||||||
|
// prefer non-ephemeral port to avoid port collision on restartNameNode
|
||||||
MiniDFSNNTopology topology = new MiniDFSNNTopology()
|
MiniDFSNNTopology topology = new MiniDFSNNTopology()
|
||||||
.addNameservice(new MiniDFSNNTopology.NSConf("ns1")
|
.addNameservice(new MiniDFSNNTopology.NSConf("ns1")
|
||||||
.addNN(new MiniDFSNNTopology.NNConf("nn1").setIpcPort(10021))
|
.addNN(new MiniDFSNNTopology.NNConf("nn1")
|
||||||
.addNN(new MiniDFSNNTopology.NNConf("nn2").setIpcPort(10022)));
|
.setIpcPort(ServerSocketUtil.getPort(10021, 100)))
|
||||||
|
.addNN(new MiniDFSNNTopology.NNConf("nn2")
|
||||||
|
.setIpcPort(ServerSocketUtil.getPort(10022, 100))));
|
||||||
cluster = new MiniDFSCluster.Builder(conf)
|
cluster = new MiniDFSCluster.Builder(conf)
|
||||||
.nnTopology(topology)
|
.nnTopology(topology)
|
||||||
.numDataNodes(0)
|
.numDataNodes(0)
|
||||||
|
|
Loading…
Reference in New Issue